# cython: language_level=3, distutils: language=c

cdef extern from "string.h":
    void* memset(void* ptr, int value, size_t num)
    
cdef extern from "windows.h":
    ctypedef long HRESULT
    
cdef extern from "py_compat.h":
    pass

cimport cython
include'globals.pyx'
include'constant.pyx'
include'adapter_callback.pyx'

from typedef cimport *
from struct cimport *
from render cimport *
from factory cimport *
from base cimport *

cdef BOOL OnMsgHandler(const LPMSG pMsg, LRESULT *pRes, void *ctx) noexcept with gil:
    this = <object><PyObject*>ctx
    msg_handler = this.GetMsgHandler()
    if msg_handler is not None:
        func = msg_handler.msg.get(<DWORD_PTR>pMsg.message)
        if func is not None:
            result = func(cls=this, message=<DWORD>pMsg.message, hWnd=<DWORD_PTR>pMsg.hwnd, wParam=<DWORD>pMsg.wParam, lParam=<DWORD>pMsg.lParam)
            if result:
                pRes[0] = <INT_PTR>result
            return <BOOL><bool>result
    return 0

cdef BOOL OnEventHandler(IEvtArgs *evt, void *ctx) noexcept with gil:
    cdef int now_event_id
    cdef int id_from
    cdef const WCHAR* name_from
    this = <object><PyObject*>ctx
    event_handler = this.GetEventHandler()
    if event_handler is not None:
        count = 0
        now_event_id = evt.lpVtbl.GetID(evt)
        id_from = evt.lpVtbl.IdFrom(evt)
        name_from = evt.lpVtbl.NameFrom(evt)
        evt.lpVtbl.SetBubbleUp(evt, False)
        for (event_id, identifier), func in event_handler.events.items():
            if event_id == now_event_id and \
                (identifier in [id_from, name_from, None] or \
                (isinstance(identifier, tuple) and \
                identifier[0] <= id_from <= identifier[1])):
                count += 1
                func(cls=this, evt=SEvtArgs(<DWORD_PTR>evt))
                if not evt.lpVtbl.IsBubbleUp(evt):
                    break
        return count > 0
    return 0

cdef BOOL OnEventSlotHandler(IEvtArgs *evt, void *ctx) noexcept with gil:
    func = <object><void*><Py_ssize_t>ctx
    return <BOOL><bool>func(SEvtArgs(<DWORD_PTR>evt))

cdef BOOL __stdcall OnEnumRes(LPCTSTR pszType, LPCTSTR pszName, LPARAM lp) noexcept with gil:
    func = <object><void*><Py_ssize_t>lp
    return <BOOL><bool>func(pszType, pszName)

def SMessageBox(hWnd, lpText, lpCaption, uType=0):
    return _SMessageBox(<HWND><DWORD_PTR>hWnd, lpText, lpCaption, uType)

cdef void OnRUNONUI(WPARAM wp, LPARAM lp) noexcept with gil:
    func = <object><void*><Py_ssize_t>wp
    if lp == 0: # 异步
        func()
        Py_DECREF(func)
    else:
        result = <object><void*><Py_ssize_t>lp
        result[0] = func()

def SRUNONUISYNC(func):
    if SOUI.NOTIFY_CENTER is not None:
        return SOUI.NOTIFY_CENTER.RunOnUI2(func, True)

def SRUNONUI(func):
    if SOUI.NOTIFY_CENTER is not None:
        SOUI.NOTIFY_CENTER.RunOnUI2(func, False)

cdef class OwnerPointer:
    cdef DWORD_PTR _thisptr
    cdef BOOL _owner

    def __init__(self, ptr=0, owner=False):
        if hasattr(ptr, 'ptr'):
            self._thisptr = ptr.ptr()
        else:
            self._thisptr = ptr
        self._owner = owner
        
    def __dealloc__(self):
        if self._owner:
            self.free()
    
    def free(self):
        pass

    def ptr(self):
        return self._thisptr

cdef class SObjRef(OwnerPointer):
    def AddRef(self):
        cdef IObjRef* this = <IObjRef*><DWORD_PTR>self._thisptr
        return this.lpVtbl.AddRef(this)

    def Release(self):
        cdef IObjRef* this = <IObjRef*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Release(this)

    def OnFinalRelease(self):
        cdef IObjRef* this = <IObjRef*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnFinalRelease(this)

cdef class SObject(SObjRef):
    # BOOL IsClass(IObject* this, LPCWSTR lpszName)
    def IsClass(self, lpszName):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsClass(this, lpszName)

    # LPCWSTR GetObjectClass(IObject* this)
    def GetObjectClass(self):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetObjectClass(this)

    # int GetObjectType(IObject* this)
    def GetObjectType(self):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetObjectType(this)

    # int GetID(IObject* this)
    def GetID(self):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetID(this)

    # void SetID(IObject* this, int nID)
    def SetID(self, nID):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetID(this, nID)

    # LPCWSTR GetName(IObject* this)
    def GetName(self):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetName(this)

    # void SetName(IObject* this, LPCWSTR pszName)
    def SetName(self, pszName):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetName(this, pszName)

    # BOOL InitFromXml(IObject* this, IXmlNode* xmlNode)
    def InitFromXml(self, xmlNode):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.InitFromXml(this, <IXmlNode*><DWORD_PTR>xmlNode)

    # void OnInitFinished(IObject* this, IXmlNode* xmlNode)
    def OnInitFinished(self, xmlNode):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnInitFinished(this, <IXmlNode*><DWORD_PTR>xmlNode)

    # HRESULT SetAttribute(IObject* this, LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading)
    def SetAttribute(self, pszAttr, pszValue, bLoading=True):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetAttribute(this, pszAttr, pszValue, <BOOL>bLoading)

    # BOOL GetAttribute(IObject* this, LPCWSTR strAttr, IStringW*pValue)
    def GetAttribute(self, strAttr):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        pValue = SOUI.SOUI_FACTORY.CreateStringW()
        r = this.lpVtbl.GetAttribute(this, strAttr, <IStringW*><DWORD_PTR>pValue.ptr())
        return pValue.c_str()

    # HRESULT AfterAttribute(IObject* this, LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading, HRESULT hr)
    def AfterAttribute(self, pszAttr, pszValue, bLoading, hr):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        return this.lpVtbl.AfterAttribute(this, pszAttr, pszValue, <BOOL>bLoading, hr)

    # void SetAttrHandler(IObject* this, FunAttrHandler attrHandler)
    def SetAttrHandler(self, attrHandler):
        cdef IObject* this = <IObject*><DWORD_PTR>self._thisptr
        # this.lpVtbl.SetAttrHandler(this, <FunAttrHandler>attrHandler)

cdef class SouiFactory(SObjRef):
    cdef HMODULE _hinstance
    cdef object _funcs

    def __init__(self, hinstance):
        cdef ISouiFactory* souiFac = _CreateSouiFactory()
        super().__init__(<DWORD_PTR>souiFac)

        self._hinstance = <HMODULE>hinstance
        self._funcs = []

    # IApplication* CreateApp(ISouiFactory* this, IRenderFactory*pRenderFac,HMODULE hInst,LPCTSTR pszHostClassName, BOOL bImeApp)
    def CreateApp(self, render_factory, class_name='SOUI4'):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IRenderFactory* renderFac = <IRenderFactory*><DWORD_PTR>render_factory.ptr()
        cdef IApplication* obj = this.lpVtbl.CreateApp(this, renderFac, self._hinstance, 'SOUI4', <BOOL>False)
        if obj != NULL:
            return SApplication(<DWORD_PTR>obj)

    # INativeWnd* CreateNativeWnd(ISouiFactory* this)
    def CreateNativeWnd(self):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef INativeWnd* obj = this.lpVtbl.CreateNativeWnd(this)
        if obj != NULL:
            return SNativeWnd(<DWORD_PTR>obj)

    # IHostWnd* CreateHostWnd(ISouiFactory* this, LPCTSTR pszResID)
    def CreateHostWnd(self, pszResID):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IHostWnd* obj = this.lpVtbl.CreateHostWnd(this, pszResID)
        if obj!= NULL:
            return SHostWnd(<DWORD_PTR>obj)

    # IHostDialog* CreateHostDialog(ISouiFactory* this, LPCTSTR pszResID)
    def CreateHostDialog(self, pszResID):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IHostDialog* obj = this.lpVtbl.CreateHostDialog(this, pszResID)
        if obj != NULL:
            return SHostDialog(<DWORD_PTR>obj)

    # IStringA* CreateStringA(ISouiFactory* this, LPCSTR pszSrc)
    def CreateStringA(self, pszSrc=''):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        # return this.lpVtbl.CreateStringA(this, <LPCSTR>pszSrc)

    # IStringW* CreateStringW(ISouiFactory* this, LPCWSTR pszSrc)
    def CreateStringW(self, pszSrc=''):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IStringW* obj = this.lpVtbl.CreateStringW(this, pszSrc)
        if obj != NULL:
            return SStringW(<DWORD_PTR>obj)

    # IXmlDoc* CreateXmlDoc(ISouiFactory* this)
    def CreateXmlDoc(self):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IXmlDoc* obj = this.lpVtbl.CreateXmlDoc(this)
        if obj != NULL:
            return SXmlDoc(<DWORD_PTR>obj)

    # IResProvider* CreateResProvider(ISouiFactory* this, BUILTIN_RESTYPE resType)
    def CreateResProvider(self, resType):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IResProvider* obj = this.lpVtbl.CreateResProvider(this, <BUILTIN_RESTYPE>resType)
        if obj != NULL:
            return SResProvider(<DWORD_PTR>obj)

    # IEvtSlot* CreateFuncSlot(ISouiFactory* this, FunCallback fun, void*ctx)
    def CreateFuncSlot(self, func):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        if not func in self._funcs:
            self._funcs.append(func)
        idx = self._funcs.index(func)
        _id = id(self._funcs[idx])
        cdef IEvtSlot* obj = this.lpVtbl.CreateFuncSlot(this, OnEventSlotHandler, <void*><Py_ssize_t><DWORD_PTR>_id)
        if obj != NULL:
            return SEvtSlot(<DWORD_PTR>obj)

    # IMenu* CreateMenu(ISouiFactory* this, HMENU hMenu)
    def CreateMenu(self, hMenu=0):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IMenu* obj = this.lpVtbl.CreateMenu(this, <HMENU><DWORD_PTR>hMenu)
        if obj != NULL:
            return SMenu(<DWORD_PTR>obj)

    # IMenuEx* CreateMenuEx(ISouiFactory* this)
    def CreateMenuEx(self):
        cdef ISouiFactory* this = <ISouiFactory*><DWORD_PTR>self._thisptr
        cdef IMenuEx* obj = this.lpVtbl.CreateMenuEx(this)
        if obj != NULL:
            return SMenuEx(<DWORD_PTR>obj)

    # 创建图片解码引擎
    def CreateImgDecoder_Stb(self):
        cdef IImgDecoderFactory* imgDecoderFac = NULL
        if Decoder_Stb_SCreateInstance(<IObjRef**>&imgDecoderFac):
            return SImgDecoderFactory(<DWORD_PTR>imgDecoderFac)

    # 创建渲染引擎
    def CreateRender_GDI(self):
        cdef IRenderFactory* renderFac = NULL
        if Render_Gdi_SCreateInstance(<IObjRef**>&renderFac):
            return SRenderFactory(<DWORD_PTR>renderFac)

    def CreateRender_Skia(self):
        cdef IRenderFactory* renderFac = NULL
        if Render_Skia_SCreateInstance(<IObjRef**>&renderFac):
            return SRenderFactory(<DWORD_PTR>renderFac)

    def CreateLog4z(self):
        cdef ILogMgr* log4zFac = NULL
        if Log4z_SCreateInstance(<IObjRef**>&log4zFac):
            return SLog4zManager(<DWORD_PTR>log4zFac)

    def CreateResProvider_7ZIP(self):
        cdef IResProvider* resProviderFac = NULL
        if Resp_7zip_SCreateInstance(<IObjRef**>&resProviderFac):
            return SResProvider(<DWORD_PTR>resProviderFac)

    def CreateResProvider_ZIP(self):
        cdef IResProvider* resProviderFac = NULL
        if Resp_Zip_SCreateInstance(<IObjRef**>&resProviderFac):
            return SResProvider(<DWORD_PTR>resProviderFac)
    
    def CreateScrpit_Lua(self):
        cdef IScriptFactory* scriptLuaFac = NULL
        if Script_Lua_SCreateInstance(<IObjRef**>&scriptLuaFac):
            return SScriptFactory(<DWORD_PTR>scriptLuaFac)
    
    def CreateTaskLoop(self):
        cdef ITaskLoop* taskloopFac = NULL
        if TaskLoop_SCreateInstance(<IObjRef**>&taskloopFac):
            return STaskLoop(<DWORD_PTR>taskloopFac)
    
    def CreateTranslator(self):
        cdef ITranslatorMgr* transFac = NULL
        if Translator_SCreateInstance(<IObjRef**>&transFac):
            return STranslatorMgr(<DWORD_PTR>transFac)

cdef class SApplication(SObjRef):
    # HMODULE GetModule(IApplication* this)
    def GetModule(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetModule(this)

    # UINT LoadSystemNamedResource(IApplication* this, IResProvider* pResProvider)
    def LoadSystemNamedResource(self, pResProvider):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadSystemNamedResource(this, <IResProvider*><DWORD_PTR>pResProvider.ptr())

    # ITranslatorMgr* GetTranslator(IApplication* this)
    def GetTranslator(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef ITranslatorMgr* obj = this.lpVtbl.GetTranslator(this)
        if obj != NULL:
            return STranslatorMgr(<DWORD_PTR>obj)

    # void SetTranslator(IApplication* this, ITranslatorMgr* pTrans)
    def SetTranslator(self, pTrans):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetTranslator(this, <ITranslatorMgr*><DWORD_PTR>pTrans.ptr())

    # IToolTipFactory* GetToolTipFactory(IApplication* this)
    def GetToolTipFactory(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IToolTipFactory* obj =  this.lpVtbl.GetToolTipFactory(this)
        if obj != NULL:
            return SToolTipFactory(<DWORD_PTR>obj)

    # void SetToolTipFactory(IApplication* this, IToolTipFactory* pToolTipFac)
    def SetToolTipFactory(self, pToolTipFac):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetToolTipFactory(this, <IToolTipFactory*><DWORD_PTR>pToolTipFac.ptr())

    # BOOL SetMsgLoopFactory(IApplication* this, IMsgLoopFactory* pMsgLoopFac)
    def SetMsgLoopFactory(self, pMsgLoopFac):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetMsgLoopFactory(this, <IMsgLoopFactory*><DWORD_PTR>pMsgLoopFac.ptr())

    # IMsgLoopFactory* GetMsgLoopFactory(IApplication* this)
    def GetMsgLoopFactory(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IMsgLoopFactory* obj = this.lpVtbl.GetMsgLoopFactory(this)
        if obj != NULL:
            return SMsgLoopFactory(<DWORD_PTR>obj)

    # void SetLogManager(IApplication* this, ILogMgr* pLogMgr)
    def SetLogManager(self, pLogMgr):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetLogManager(this, <ILogMgr*><DWORD_PTR>pLogMgr.ptr())

    # ILogMgr* GetLogManager(IApplication* this)
    def GetLogManager(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef ILogMgr* obj = this.lpVtbl.GetLogManager(this)
        if obj != NULL:
            return SLog4zManager(<DWORD_PTR>obj)

    # void SetAttrStorageFactory(IApplication* this, IAttrStorageFactory* pAttrStorageFactory)
    def SetAttrStorageFactory(self, pAttrStorageFactory):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAttrStorageFactory(this, <IAttrStorageFactory*><DWORD_PTR>pAttrStorageFactory.ptr())

    # IAttrStorageFactory* GetAttrStorageFactory(IApplication* this)
    def GetAttrStorageFactory(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IAttrStorageFactory* obj = this.lpVtbl.GetAttrStorageFactory(this)
        if obj != NULL:
            return SAttrStorageFactory(<DWORD_PTR>obj)

    # int Run(IApplication* this, HWND hMainWnd)
    def Run(self, hMainWnd):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef PyThreadState * state = PyEval_SaveThread()
        iRet = this.lpVtbl.Run(this, <HWND><DWORD_PTR>hMainWnd)
        PyEval_RestoreThread(state)
        return iRet

    # HWND GetMainWnd(IApplication* this)
    def GetMainWnd(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetMainWnd(this)

    # BOOL AddMsgLoop(IApplication* this, IMessageLoop* pMsgLoop, BOOL bReplace)
    def AddMsgLoop(self, pMsgLoop, bReplace=False):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AddMsgLoop(this, <IMessageLoop*><DWORD_PTR>pMsgLoop.ptr(), <BOOL>bReplace)

    # BOOL RemoveMsgLoop(IApplication* this)
    def RemoveMsgLoop(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveMsgLoop(this)

    # IMessageLoop* GetMsgLoop(IApplication* this, DWORD dwThreadID)
    def GetMsgLoop(self, dwThreadID):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IMessageLoop* obj = this.lpVtbl.GetMsgLoop(this, dwThreadID)
        if obj != NULL:
            return SMessageLoop(<DWORD_PTR>obj)

    # IResProviderMgr* GetResProviderMgr(IApplication* this)
    def GetResProviderMgr(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IResProviderMgr* obj = this.lpVtbl.GetResProviderMgr(this)
        if obj != NULL:
            return SResProviderMgr(<DWORD_PTR>obj)

    # IRealWndHandler* GetRealWndHander(IApplication* this)
    def GetRealWndHander(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IRealWndHandler* obj = this.lpVtbl.GetRealWndHander(this)
        if obj != NULL:
            return SRealWndHandler(<DWORD_PTR>obj)

    # void SetRealWndHandler(IApplication* this, IRealWndHandler* pRealHandler)
    def SetRealWndHandler(self, pRealHandler):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetRealWndHandler(this, <IRealWndHandler*><DWORD_PTR>pRealHandler.ptr())

    # IRenderFactory* GetRenderFactory(IApplication* this)
    def GetRenderFactory(self):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IRenderFactory* obj = this.lpVtbl.GetRenderFactory(this)
        if obj != NULL:
            return SRenderFactory(<DWORD_PTR>obj)

    # void SetScriptFactory(IApplication* this, IScriptFactory* pScriptModule)
    def SetScriptFactory(self, pScriptModule):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetScriptFactory(this, <IScriptFactory*><DWORD_PTR>pScriptModule.ptr())

    # void InitXmlNamedID(IApplication* this, const LPCWSTR*pNames, const int*nIds, int nCount)
    def InitXmlNamedID(self, pNames, nIds):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        # this.lpVtbl.InitXmlNamedID(this, <const LPCWSTR*>pNames, <const int*>nIds, nCount)

    # IXmlDoc* LoadXmlDocment(IApplication* this, LPCTSTR strResId)
    def LoadXmlDocment(self, strResId):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IXmlDoc* obj = this.lpVtbl.LoadXmlDocment(this, strResId)
        if obj != NULL:
            return SXmlDoc(<DWORD_PTR>obj)

    # IAnimation* LoadAnimation(IApplication* this, LPCTSTR strResId)
    def LoadAnimation(self, strResId):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IAnimation* obj = this.lpVtbl.LoadAnimation(this, strResId)
        if obj != NULL:
            return SAnimation(<DWORD_PTR>obj)

    # IValueAnimator* LoadValueAnimator(IApplication* this, LPCTSTR strResId)
    def LoadValueAnimator(self, strResId):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IValueAnimator* obj = this.lpVtbl.LoadValueAnimator(this, strResId)
        if obj != NULL:
            return SValueAnimator(<DWORD_PTR>obj)

    # void EnableNotifyCenter(IApplication* this, BOOL bEnable,int interval)
    def EnableNotifyCenter(self, bEnable, interval=20):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnableNotifyCenter(this, <BOOL>bEnable, interval)

    # void* GetInnerSingleton(IApplication* this, SingletonType type)
    def GetInnerSingleton(self, type):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef void* obj = this.lpVtbl.GetInnerSingleton(this, <SingletonType>type)
        if obj != NULL:
            obj_type = Singleton_OBJS.get(type)
            if obj_type is None:
                return <DWORD_PTR>obj
            return obj_type(<DWORD_PTR>obj)

    # IObject* CreateObject(IApplication* this, LPCWSTR pszName, SObjectType nType)
    def CreateObject(self, pszName, nType):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        cdef IObject* obj = this.lpVtbl.CreateObject(this, pszName, <SObjectType>nType)
        if obj != NULL:
            return SObject(<DWORD_PTR>obj)

    # void SetCreateObjectCallback(IApplication* this, FunCreateObject cbCreateObj)
    def SetCreateObjectCallback(self, cbCreateObj):
        cdef IApplication* this = <IApplication*><DWORD_PTR>self._thisptr
        #this.lpVtbl.SetCreateObjectCallback(this, <FunCreateObject>cbCreateObj)

cdef class SNotifyCenter(OwnerPointer):
    # void FireEventSync(INotifyCenter* this, IEvtArgs*e)
    def FireEventSync(self, e):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        this.lpVtbl.FireEventSync(this, <IEvtArgs*><DWORD_PTR>e.ptr())

    # void FireEventAsync(INotifyCenter* this, IEvtArgs*e)
    def FireEventAsync(self, e):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        this.lpVtbl.FireEventAsync(this, <IEvtArgs*><DWORD_PTR>e.ptr())

    # BOOL RegisterEventMap(INotifyCenter* this, const IEvtSlot*slot)
    def RegisterEventMap(self, slot):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RegisterEventMap(this, <const IEvtSlot*><DWORD_PTR>slot.ptr())

    # BOOL UnregisterEventMap(INotifyCenter* this, const IEvtSlot*slot)
    def UnregisterEventMap(self, slot):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnregisterEventMap(this, <const IEvtSlot*><DWORD_PTR>slot.ptr())

    # void RunOnUI(INotifyCenter* this, IRunnable* pRunnable,BOOL bSync)
    def RunOnUI(self, pRunnable, bSync=True):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        this.lpVtbl.RunOnUI(this, <IRunnable*>pRunnable, <BOOL>bSync)

    # void RunOnUI2(INotifyCenter* this, FunRunOnUI fun, WPARAM wp, LPARAM lp,BOOL bSync)
    def RunOnUI2(self, func, bSync=True):
        cdef INotifyCenter* this = <INotifyCenter*><DWORD_PTR>self._thisptr
        result = [None]
        func_id = id(func)
        result_id = id(result)
        if bSync:
            this.lpVtbl.RunOnUI2(this, OnRUNONUI, <WPARAM>func_id, <LPARAM>result_id, <BOOL>bSync)
        else:
            Py_INCREF(func)
            this.lpVtbl.RunOnUI2(this, OnRUNONUI, <WPARAM>func_id, 0, <BOOL>bSync)
        return result[0]

cdef class SRenderTarget(SObjRef):
    # HRESULT CreatePen(IRenderTarget* this, int iStyle, COLORREF cr, int cWidth, IPenS**ppPen)
    def CreatePen(self, iStyle, cr, cWidth):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IPenS* _ppPen
        if this.lpVtbl.CreatePen(this, iStyle, <COLORREF>cr, cWidth, &_ppPen) != 0:
            return None
        return SPenS(<DWORD_PTR>_ppPen)

    # HRESULT CreateSolidColorBrush(IRenderTarget* this, COLORREF cr, IBrushS**ppBrush)
    def CreateSolidColorBrush(self, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IBrushS* _ppBrush
        if this.lpVtbl.CreateSolidColorBrush(this, <COLORREF>cr, &_ppBrush) != 0:
            return None
        return SBrushS(<DWORD_PTR>_ppBrush)

    # HRESULT CreateBitmapBrush(IRenderTarget* this, IBitmapS* pBmp, TileMode xtm, TileMode ytm, IBrushS**ppBrush)
    def CreateBitmapBrush(self, pBmp, xtm=0, ytm=0):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IBrushS* _ppBrush
        if this.lpVtbl.CreateBitmapBrush(this, <IBitmapS*><DWORD_PTR>pBmp.ptr(), <TileMode>xtm, <TileMode>ytm, &_ppBrush) != 0:
            return None
        return SBrushS(<DWORD_PTR>_ppBrush)

    # HRESULT CreateRegion(IRenderTarget* this, IRegionS**ppRegion)
    def CreateRegion(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IRegionS* _ppRegion
        if this.lpVtbl.CreateRegion(this, &_ppRegion) != 0:
            return None
        return SRegionS(<DWORD_PTR>_ppRegion)

    # HRESULT Resize(IRenderTarget* this, SIZE sz)
    def Resize(self, sz):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef SIZE _sz = SIZE(sz['cx'], sz['cy'])
        return this.lpVtbl.Resize(this, _sz)

    # HRESULT OffsetViewportOrg(IRenderTarget* this, int xOff, int yOff, LPPOINT lpPoint)
    def OffsetViewportOrg(self, xOff, yOff, lpPoint):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef POINT _lpPoint = POINT(lpPoint['x'], lpPoint['y'])
        if this.lpVtbl.OffsetViewportOrg(this, xOff, yOff, &_lpPoint) == 0:
            return {'x': _lpPoint.x, 'y': _lpPoint.y}

    # HRESULT GetViewportOrg(IRenderTarget* this, LPPOINT lpPoint)
    def GetViewportOrg(self, lpPoint):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef POINT _lpPoint = POINT(lpPoint['x'], lpPoint['y'])
        if this.lpVtbl.GetViewportOrg(this, &_lpPoint) == 0:
            return {'x': _lpPoint.x, 'y': _lpPoint.y}

    # HRESULT SetViewportOrg(IRenderTarget* this, POINT pt)
    def SetViewportOrg(self, pt):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        return this.lpVtbl.SetViewportOrg(this, _pt)

    # HRESULT PushClipRect(IRenderTarget* this, LPCRECT pRect, UINT mode)
    def PushClipRect(self, pRect, mode):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.PushClipRect(this, &_pRect, mode)

    # HRESULT PushClipRegion(IRenderTarget* this, IRegionS* pRegion, UINT mode)
    def PushClipRegion(self, pRegion, mode):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.PushClipRegion(this, <IRegionS*><DWORD_PTR>pRegion.ptr(), mode)

    # HRESULT PopClip(IRenderTarget* this)
    def PopClip(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.PopClip(this)

    # HRESULT ExcludeClipRect(IRenderTarget* this, LPCRECT pRc)
    def ExcludeClipRect(self, pRc):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRc = RECT(pRc['left'], pRc['top'], pRc['right'], pRc['bottom'])
        return this.lpVtbl.ExcludeClipRect(this, &_pRc)

    # HRESULT SaveClip(IRenderTarget* this, int*pnState)
    def SaveClip(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef int _pnState
        if this.lpVtbl.SaveClip(this, &_pnState) == 0:
            return _pnState

    # HRESULT RestoreClip(IRenderTarget* this, int nState)
    def RestoreClip(self, nState):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.RestoreClip(this, nState)

    # HRESULT GetClipRegion(IRenderTarget* this, IRegionS**ppRegion)
    def GetClipRegion(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IRegionS* _ppRegion
        if this.lpVtbl.GetClipRegion(this, &_ppRegion) != 0:
            return None
        return SRegionS(<DWORD_PTR>_ppRegion)

    # HRESULT GetClipBox(IRenderTarget* this, LPRECT prc)
    def GetClipBox(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _prc
        if this.lpVtbl.GetClipBox(this, &_prc) == 0:
            return {'left': _prc.left, 'top': _prc.top, 'right': _prc.right, 'bottom': _prc.bottom}

    # HRESULT DrawText(IRenderTarget* this, LPCTSTR pszText, int cchLen, LPRECT pRc, UINT uFormat)
    def DrawText(self, pszText, cchLen, rc, uFormat):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRc = RECT(rc['left'], rc['top'], rc['right'], rc['bottom'])
        if this.lpVtbl.DrawText(this, pszText, cchLen, &_pRc, uFormat) == 0:
            return {'left': _pRc.left, 'top': _pRc.top, 'right': _pRc.right, 'bottom': _pRc.bottom}

    # HRESULT MeasureText(IRenderTarget* this, LPCTSTR pszText, int cchLen, SIZE*psz)
    def MeasureText(self, pszText, cchLen):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef SIZE _psz
        if this.lpVtbl.MeasureText(this, pszText, cchLen, &_psz) == 0:
            return {'cx': _psz.cx, 'cy': _psz.cy}

    # HRESULT TextOut(IRenderTarget* this, int x, int y, LPCTSTR lpszString, int nCount)
    def TextOut(self, x, y, lpszString, nCount):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.TextOut(this, x, y, lpszString, nCount)

    # HRESULT DrawRectangle(IRenderTarget* this, LPCRECT pRect)
    def DrawRectangle(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.DrawRectangle(this, &_pRect)

    # HRESULT FillRectangle(IRenderTarget* this, LPCRECT pRect)
    def FillRectangle(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.FillRectangle(this, &_pRect)

    # HRESULT FillSolidRect(IRenderTarget* this, LPCRECT pRect, COLORREF cr)
    def FillSolidRect(self, pRect, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.FillSolidRect(this, &_pRect, <COLORREF>cr)

    # HRESULT DrawRoundRect(IRenderTarget* this, LPCRECT pRect, POINT pt)
    def DrawRoundRect(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        return this.lpVtbl.DrawRoundRect(this, &_pRect, _pt)

    # HRESULT FillRoundRect(IRenderTarget* this, LPCRECT pRect, POINT pt)
    def FillRoundRect(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        return this.lpVtbl.FillRoundRect(this, &_pRect, _pt)

    # HRESULT FillSolidRoundRect(IRenderTarget* this, LPCRECT pRect, POINT pt, COLORREF cr)
    def FillSolidRoundRect(self, pRect, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        return this.lpVtbl.FillSolidRoundRect(this, &_pRect, _pt, <COLORREF>cr)

    # HRESULT ClearRect(IRenderTarget* this, LPCRECT pRect, COLORREF cr)
    def ClearRect(self, pRect, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.ClearRect(this, &_pRect, <COLORREF>cr)

    # HRESULT InvertRect(IRenderTarget* this, LPCRECT pRect)
    def InvertRect(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.InvertRect(this, &_pRect)

    # HRESULT DrawEllipse(IRenderTarget* this, LPCRECT pRect)
    def DrawEllipse(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.DrawEllipse(this, &_pRect)

    # HRESULT FillEllipse(IRenderTarget* this, LPCRECT pRect)
    def FillEllipse(self, pRect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.FillEllipse(this, &_pRect)

    # HRESULT FillSolidEllipse(IRenderTarget* this, LPCRECT pRect, COLORREF cr)
    def FillSolidEllipse(self, pRect, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.FillSolidEllipse(this, &_pRect, <COLORREF>cr)

    # HRESULT DrawArc(IRenderTarget* this, LPCRECT pRect, float startAngle, float sweepAngle, BOOL useCenter)
    def DrawArc(self, pRect, startAngle, sweepAngle, useCenter):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.DrawArc(this, &_pRect, startAngle, sweepAngle, <BOOL>useCenter)

    # HRESULT FillArc(IRenderTarget* this, LPCRECT pRect, float startAngle, float sweepAngle)
    def FillArc(self, pRect, startAngle, sweepAngle):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRect = RECT(pRect['left'], pRect['top'], pRect['right'], pRect['bottom'])
        return this.lpVtbl.FillArc(this, &_pRect, startAngle, sweepAngle)

    # HRESULT DrawLines(IRenderTarget* this, LPPOINT pPt, size_t nCount)
    def DrawLines(self, pts):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        count = len(pts)
        cdef POINT *_pts = <POINT*>malloc(count * sizeof(POINT))
        for idx, pt in enumerate(pts):
            _pts[idx].x, _pts[idx].y = pt['x'], pt['y']
        ret = this.lpVtbl.DrawLines(this, _pts, count)
        free(_pts)
        return ret

    # HRESULT DrawIconEx(IRenderTarget* this, int xLeft, int yTop, HICON hIcon, int cxWidth, int cyWidth, UINT diFlags)
    def DrawIconEx(self, xLeft, yTop, hIcon, cxWidth, cyWidth, diFlags):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.DrawIconEx(this, xLeft, yTop, <HICON><DWORD_PTR>hIcon, cxWidth, cyWidth, diFlags)

    # HRESULT DrawBitmap(IRenderTarget* this, LPCRECT pRcDest, const IBitmapS*pBitmap, int xSrc, int ySrc, BYTE byAlpha)
    def DrawBitmap(self, pRcDest, pBitmap, xSrc, ySrc, byAlpha):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRcDest = RECT(pRcDest['left'], pRcDest['top'], pRcDest['right'], pRcDest['bottom'])
        return this.lpVtbl.DrawBitmap(this, &_pRcDest, <const IBitmapS*><DWORD_PTR>pBitmap.ptr(), xSrc, ySrc, <BYTE>byAlpha)

    # HRESULT DrawBitmapEx(IRenderTarget* this, LPCRECT pRcDest, const IBitmapS*pBitmap, LPCRECT pRcSrc, UINT expendMode, BYTE byAlpha)
    def DrawBitmapEx(self, pRcDest, pBitmap, pRcSrc, expendMode, byAlpha):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRcDest = RECT(pRcDest['left'], pRcDest['top'], pRcDest['right'], pRcDest['bottom'])
        cdef RECT _pRcSrc = RECT(pRcSrc['left'], pRcSrc['top'], pRcSrc['right'], pRcSrc['bottom'])
        return this.lpVtbl.DrawBitmapEx(this, &_pRcDest, <const IBitmapS*><DWORD_PTR>pBitmap.ptr(), &_pRcSrc, expendMode, <BYTE>byAlpha)

    # HRESULT DrawBitmap9Patch(IRenderTarget* this, LPCRECT pRcDest, const IBitmapS*pBitmap, LPCRECT pRcSrc, LPCRECT pRcSourMargin, UINT expendMode, BYTE byAlpha)
    def DrawBitmap9Patch(self, pRcDest, pBitmap, pRcSrc, pRcSourMargin, expendMode, byAlpha):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRcDest = RECT(pRcDest['left'], pRcDest['top'], pRcDest['right'], pRcDest['bottom'])
        cdef RECT _pRcSrc = RECT(pRcSrc['left'], pRcSrc['top'], pRcSrc['right'], pRcSrc['bottom'])
        cdef RECT _pRcSourMargin = RECT(pRcSourMargin['left'], pRcSourMargin['top'], pRcSourMargin['right'], pRcSourMargin['bottom'])
        return this.lpVtbl.DrawBitmap9Patch(this, &_pRcDest, <const IBitmapS*><DWORD_PTR>pBitmap.ptr(), &_pRcSrc, &_pRcSourMargin, expendMode, <BYTE>byAlpha)

    # HRESULT BitBlt(IRenderTarget* this, LPCRECT pRcDest, IRenderTarget* pRTSour, int xSrc, int ySrc, DWORD dwRop)
    def BitBlt(self, pRcDest, pRTSour, xSrc, ySrc, dwRop):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRcDest = RECT(pRcDest['left'], pRcDest['top'], pRcDest['right'], pRcDest['bottom'])
        return this.lpVtbl.BitBlt(this, &_pRcDest, <IRenderTarget*><DWORD_PTR>pRTSour.ptr(), xSrc, ySrc, dwRop)

    # HRESULT AlphaBlend(IRenderTarget* this, LPCRECT pRcDest, IRenderTarget* pRTSrc, LPCRECT pRcSrc, BYTE byAlpha)
    def AlphaBlend(self, pRcDest, pRTSrc, pRcSrc, byAlpha):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef RECT _pRcDest = RECT(pRcDest['left'], pRcDest['top'], pRcDest['right'], pRcDest['bottom'])
        cdef RECT _pRcSrc = RECT(pRcSrc['left'], pRcSrc['top'], pRcSrc['right'], pRcSrc['bottom'])
        return this.lpVtbl.AlphaBlend(this, &_pRcDest, <IRenderTarget*><DWORD_PTR>pRTSrc, &_pRcSrc, <BYTE>byAlpha)

    # IRenderObj* GetCurrentObject(IRenderTarget* this, OBJTYPE uType)
    def GetCurrentObject(self, uType):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IRenderObj* obj = this.lpVtbl.GetCurrentObject(this, <OBJTYPE>uType)
        if obj != NULL:
            return SRenderObj(<DWORD_PTR>obj)

    # HRESULT SelectDefaultObject(IRenderTarget* this, OBJTYPE objType, IRenderObj**pOldObj)
    def SelectDefaultObject(self, objType):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IRenderObj* _pOldObj
        if this.lpVtbl.SelectDefaultObject(this, <OBJTYPE>objType, &_pOldObj) == 0:
            return SRenderObj(<DWORD_PTR>_pOldObj)

    # HRESULT SelectObject(IRenderTarget* this, IRenderObj* pObj, IRenderObj**pOldObj)
    def SelectObject(self, pObj):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IRenderObj* _pOldObj
        if this.lpVtbl.SelectObject(this, <IRenderObj*>pObj, &_pOldObj) == 0:
            return SRenderObj(<DWORD_PTR>_pOldObj)

    # COLORREF GetTextColor(IRenderTarget* this)
    def GetTextColor(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTextColor(this)

    # COLORREF SetTextColor(IRenderTarget* this, COLORREF color)
    def SetTextColor(self, color):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetTextColor(this, <COLORREF>color)

    # void SetMaskFilter(IRenderTarget* this, IMaskFilter* pMaskFilter)
    def SetMaskFilter(self, pMaskFilter):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetMaskFilter(this, <IMaskFilter*><DWORD_PTR>pMaskFilter.ptr())

    # IMaskFilter* GetMaskFilter(IRenderTarget* this)
    def GetMaskFilter(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef IMaskFilter* obj = this.lpVtbl.GetMaskFilter(this)
        if obj != NULL:
            return SMaskFilter(<DWORD_PTR>obj)

    # HDC GetDC(IRenderTarget* this, UINT uFlag)
    def GetDC(self, uFlag):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetDC(this, uFlag)

    # void ReleaseDC(IRenderTarget* this, HDC hdc, LPCRECT pRc)
    def ReleaseDC(self, hdc, pRc):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        this.lpVtbl.ReleaseDC(this, <HDC><DWORD_PTR>hdc, <LPCRECT><DWORD_PTR>pRc)

    # HRESULT SetTransform(IRenderTarget* this, const float matrix[9], float oldMatrix[9])
    def SetTransform(self, matrix, oldMatrix):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef float _matrix[9]
        cdef float _oldMatrix[9]
        for idx, x in enumerate(matrix):
            _matrix[idx] = x
        if this.lpVtbl.SetTransform(this, _matrix, _oldMatrix) == 0:
            return [_matrix[idx] for idx in range(9)]

    # HRESULT GetTransform(const IRenderTarget* this, float matrix[9])
    def GetTransform(self, matrix):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef float _matrix[9]
        for idx, x in enumerate(matrix):
            _matrix[idx] = x
        return this.lpVtbl.GetTransform(this, _matrix)

    # COLORREF GetPixel(IRenderTarget* this, int x, int y)
    def GetPixel(self, x, y):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetPixel(this, x, y)

    # COLORREF SetPixel(IRenderTarget* this, int x, int y, COLORREF cr)
    def SetPixel(self, x, y, cr):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetPixel(this, x, y, <COLORREF>cr)

    # HRESULT PushClipPath(IRenderTarget* this, const IPathS*path, UINT mode, BOOL doAntiAlias)
    def PushClipPath(self, path, mode, doAntiAlias):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.PushClipPath(this, <const IPathS*><DWORD_PTR>path.ptr(), mode, <BOOL>doAntiAlias)

    # HRESULT DrawPath(IRenderTarget* this, const IPathS*path, IPathEffect*pathEffect)
    def DrawPath(self, path, pathEffect):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.DrawPath(this, <const IPathS*><DWORD_PTR>path.ptr(), <IPathEffect*><DWORD_PTR>pathEffect.ptr())

    # HRESULT FillPath(IRenderTarget* this, const IPathS*path)
    def FillPath(self, path):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return this.lpVtbl.FillPath(this, <const IPathS*><DWORD_PTR>path.ptr())

    # HRESULT SetXfermode(IRenderTarget* this, int mode, int*pOldMode)
    def SetXfermode(self, mode, pOldMode):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        cdef int _oldMode
        if this.lpVtbl.SetXfermode(this, mode, &_oldMode) == 0:
            return _oldMode

    # BOOL SetAntiAlias(IRenderTarget* this, BOOL bAntiAlias)
    def SetAntiAlias(self, bAntiAlias):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetAntiAlias(this, <BOOL>bAntiAlias)

    # BOOL GetAntiAlias(const IRenderTarget* this)
    def GetAntiAlias(self):
        cdef IRenderTarget* this = <IRenderTarget*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetAntiAlias(this)

cdef class ZIPRES_PARAM(OwnerPointer):
    cdef _ZIPRES_PARAM param
    cdef object zipFile
    cdef object childDir
    cdef object pszResName
    cdef object pszResType
    cdef object buffer
    def ZipFile(self, zipFile, childDir=None, pwd=None):
        self.zipFile = zipFile
        self.childDir = childDir
        _pwd = pwd.encode('ansi')
        self.param.type = ZIPFILE
        self.param.pRenderFac = <IRenderFactory*><DWORD_PTR>SOUI.APP.GetRenderFactory().ptr()
        self.param.pszZipFile = self.zipFile
        if childDir is not None:
            self.param.pszChildDir = self.childDir
        else:
            self.param.pszChildDir = NULL
        if pwd is not None:
            self.param.pszPsw = _pwd
        else:
            self.param.pszPsw = NULL
        super().__init__(<DWORD_PTR>&self.param)

    def ZipResource(self, hInst, pszResName, pszResType='zip', childDir=None, pwd=None):
        self.pszResName = pszResName
        self.pszResType = pszResType
        self.childDir = childDir
        _pwd = pwd.encode('ansi')
        self.param.type = PEDATA
        self.param.pRenderFac = <IRenderFactory*><DWORD_PTR>SOUI.APP.GetRenderFactory().ptr()
        self.param.peInfo.hInst = <HINSTANCE><DWORD_PTR>hInst
        self.param.peInfo.pszResName = self.pszResName
        self.param.peInfo.pszResType = self.pszResType
        if childDir is not None:
            self.param.pszChildDir = self.childDir
        else:
            self.param.pszChildDir = NULL
        if pwd is not None:
            self.param.pszPsw = _pwd
        else:
            self.param.pszPsw = NULL
        super().__init__(<DWORD_PTR>&self.param)

    def ZipMemory(self, buffer, childDir=None, pwd=None):
        self.buffer = buffer
        self.childDir = childDir
        _pwd = pwd.encode('ansi')
        self.param.type = MEMORYDATA
        self.param.pRenderFac = <IRenderFactory*><DWORD_PTR>SOUI.APP.GetRenderFactory().ptr()
        self.param.Memory.pByteBuffer = self.buffer
        self.param.Memory.dwByteCounts = <DWORD>len(self.buffer)
        if childDir is not None:
            self.param.pszChildDir = self.childDir
        else:
            self.param.pszChildDir = NULL
        if pwd is not None:
            self.param.pszPsw = _pwd
        else:
            self.param.pszPsw = NULL
        super().__init__(<DWORD_PTR>&self.param)

cdef class ZIP7RES_PARAM(OwnerPointer):
    cdef _ZIP7RES_PARAM param
    cdef object zipFile
    cdef object childDir
    cdef object pszResName
    cdef object pszResType
    def ZipFile(self, zipFile, childDir=None, pwd=None):
        self.zipFile = zipFile
        self.childDir = childDir
        _pwd = pwd.encode('ansi')
        self.param.type = ZIPFILE
        self.param.pRenderFac = <IRenderFactory*><DWORD_PTR>SOUI.APP.GetRenderFactory().ptr()
        self.param.pszZipFile = self.zipFile
        if childDir is not None:
            self.param.pszChildDir = self.childDir
        else:
            self.param.pszChildDir = NULL
        if pwd is not None:
            self.param.pszPsw = _pwd
        else:
            self.param.pszPsw = NULL
        super().__init__(<DWORD_PTR>&self.param)

    def ZipResource(self, hInst, pszResName, pszResType='zip', childDir=None, pwd=None):
        self.pszResName = pszResName
        self.pszResType = pszResType
        self.childDir = childDir
        _pwd = pwd.encode('ansi')
        self.param.type = PEDATA
        self.param.pRenderFac = <IRenderFactory*><DWORD_PTR>SOUI.APP.GetRenderFactory().ptr()
        self.param.peInfo.hInst = <HINSTANCE><DWORD_PTR>hInst
        self.param.peInfo.pszResName = self.pszResName
        self.param.peInfo.pszResType = self.pszResType
        if childDir is not None:
            self.param.pszChildDir = self.childDir
        else:
            self.param.pszChildDir = NULL
        if pwd is not None:
            self.param.pszPsw = _pwd
        else:
            self.param.pszPsw = NULL
        super().__init__(<DWORD_PTR>&self.param)

cdef class SResProvider(SObjRef):
    def Init(self, wParam, lParam=0):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        cdef WPARAM wParam_ = 0
        cdef LPARAM lParam_ = 0
        if isinstance(wParam, str):
            wParam_ = <WPARAM><WCHAR*>wParam
        elif isinstance(wParam, ZIPRES_PARAM):
            wParam_ = <WPARAM>wParam.ptr()
        elif isinstance(wParam, ZIP7RES_PARAM):
            wParam_ = <WPARAM>wParam.ptr()
        else:
            wParam_ = <WPARAM>wParam
        if isinstance(lParam, str):
            lParam_ = <LPARAM><WCHAR*>lParam
        else:
            lParam_ = <LPARAM>lParam
        return <BOOL>this.lpVtbl.Init(this, wParam_, lParam_)

    # BOOL HasResource(IResProvider* this, LPCTSTR pszType, LPCTSTR pszResName)
    def HasResource(self, pszType, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.HasResource(this, pszType, pszResName)

    # HICON LoadIcon(IResProvider* this, LPCTSTR pszResName, int cx, int cy)
    def LoadIcon(self, pszResName, cx, cy):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadIcon(this, pszResName, cx, cy)

    # HBITMAP LoadBitmap(IResProvider* this, LPCTSTR pszResName)
    def LoadBitmap(self, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadBitmap(this, pszResName)

    # HCURSOR LoadCursor(IResProvider* this, LPCTSTR pszResName)
    def LoadCursor(self, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadCursor(this, pszResName)

    # IBitmapS* LoadImage(IResProvider* this, LPCTSTR pszType, LPCTSTR pszResName)
    def LoadImage(self, pszType, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        cdef IBitmapS* obj = this.lpVtbl.LoadImage(this, pszType, pszResName)
        if obj != NULL:
            return SBitmapS(<DWORD_PTR>obj)

    # IImgX* LoadImgX(IResProvider* this, LPCTSTR pszType, LPCTSTR pszResName)
    def LoadImgX(self, pszType, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        cdef IImgX* obj = this.lpVtbl.LoadImgX(this, pszType, pszResName)
        if obj != NULL:
            return SImgX(<DWORD_PTR>obj)

    # size_t GetRawBufferSize(IResProvider* this, LPCTSTR pszType, LPCTSTR pszResName)
    def GetRawBufferSize(self, pszType, pszResName):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetRawBufferSize(this, pszType, pszResName)

    # BOOL GetRawBuffer(IResProvider* this, LPCTSTR pszType, LPCTSTR pszResName, LPVOID pBuf, size_t size)
    def GetRawBuffer(self, pszType, pszResName, pBufBytes):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetRawBuffer(this, pszType, pszResName, <LPVOID><DWORD_PTR>pBufBytes, <size_t>len(pBufBytes))

    # void EnumResource(IResProvider* this, EnumResCallback funEnumCB, LPARAM lp)
    def EnumResource(self, func):
        cdef IResProvider* this = <IResProvider*><DWORD_PTR>self._thisptr
        func_id = id(func)
        this.lpVtbl.EnumResource(this, OnEnumRes, <LPARAM>func_id)

cdef class SResProviderMgr(SObjRef):
    # void AddResProvider(IResProviderMgr* this, IResProvider* pResProvider, LPCTSTR pszUidef)
    def AddResProvider(self, pResProvider, pszUidef):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.AddResProvider(this, <IResProvider*><DWORD_PTR>pResProvider.ptr(), pszUidef)

    # void RemoveResProvider(IResProviderMgr* this, IResProvider* pResProvider)
    def RemoveResProvider(self, pResProvider):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.RemoveResProvider(this, <IResProvider*><DWORD_PTR>pResProvider.ptr())

    # void RemoveAll(IResProviderMgr* this)
    def RemoveAll(self):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.RemoveAll(this)

    # IResProvider* GetHeadResProvider(IResProviderMgr* this)
    def GetHeadResProvider(self):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        cdef IResProvider* obj = this.lpVtbl.GetHeadResProvider(this)
        if obj != NULL:
            return SResProvider(<DWORD_PTR>obj)

    # IResProvider* GetTailResProvider(IResProviderMgr* this)
    def GetTailResProvider(self):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        cdef IResProvider* obj = this.lpVtbl.GetTailResProvider(this)
        if obj != NULL:
            return SResProvider(<DWORD_PTR>obj)

    # void SetFilePrefix(IResProviderMgr* this, LPCTSTR pszFilePrefix)
    def SetFilePrefix(self, pszFilePrefix):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetFilePrefix(this, pszFilePrefix)

    # BOOL HasResource(IResProviderMgr* this, LPCTSTR pszType, LPCTSTR pszResName)
    def HasResource(self, pszType, pszResName):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.HasResource(this, pszType, pszResName)

    # HICON LoadIcon(IResProviderMgr* this, LPCTSTR pszResName, int cx, int cy, BOOL bFromFile)
    def LoadIcon(self, pszResName, cx, cy, bFromFile):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadIcon(this, pszResName, cx, cy, <BOOL>bFromFile)

    # HCURSOR LoadCursor(IResProviderMgr* this, LPCTSTR pszResName, BOOL bFromFile)
    def LoadCursor(self, pszResName, bFromFile):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadCursor(this, pszResName, <BOOL>bFromFile)

    # HBITMAP LoadBitmap(IResProviderMgr* this, LPCTSTR pszResName, BOOL bFromFile)
    def LoadBitmap(self, pszResName, bFromFile):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LoadBitmap(this, pszResName, <BOOL>bFromFile)

    # IBitmapS* LoadImage(IResProviderMgr* this, LPCTSTR pszType, LPCTSTR pszResName)
    def LoadImage(self, pszType, pszResName):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        cdef IBitmapS* obj = this.lpVtbl.LoadImage(this, pszType, pszResName)
        if obj != NULL:
            return SBitmapS(<DWORD_PTR>obj)

    # IImgX* LoadImgX(IResProviderMgr* this, LPCTSTR pszType, LPCTSTR pszResName)
    def LoadImgX(self, pszType, pszResName):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        cdef IImgX* obj = this.lpVtbl.LoadImgX(this, pszType, pszResName)
        if obj != NULL:
            return SImgX(<DWORD_PTR>obj)

    # size_t GetRawBufferSize(IResProviderMgr* this, LPCTSTR pszType, LPCTSTR pszResName)
    def GetRawBufferSize(self, pszType, pszResName):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetRawBufferSize(this, pszType, pszResName)

    # BOOL GetRawBuffer(IResProviderMgr* this, LPCTSTR pszType, LPCTSTR pszResName, LPVOID pBuf, size_t size)
    def GetRawBuffer(self, pszType, pszResName, pBufBytes):
        cdef IResProviderMgr* this = <IResProviderMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetRawBuffer(this, pszType, pszResName, <LPVOID><DWORD_PTR>pBufBytes, <size_t>len(pBufBytes))

cdef class SImgDecoderFactory(SObjRef):
    # BOOL CreateImgX(IImgDecoderFactory* this, IImgX**ppImgDecoder)
    def CreateImgX(self):
        cdef IImgDecoderFactory* this = <IImgDecoderFactory*><DWORD_PTR>self._thisptr
        cdef IImgX* _ppImgDecoder
        if this.lpVtbl.CreateImgX(this, &_ppImgDecoder):
            return SImgX(<DWORD_PTR>_ppImgDecoder)

    # HRESULT SaveImage(IImgDecoderFactory* this, BYTE* pBits, int nWid, int nHei, LPCWSTR pszFileName, LPVOID pFormat)
    def SaveImage(self, pBits, nWid, nHei, pszFileName, pFormat):
        cdef IImgDecoderFactory* this = <IImgDecoderFactory*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SaveImage(this, <BYTE*>pBits, nWid, nHei, pszFileName, <LPVOID><DWORD_PTR>pFormat)

    # LPCWSTR GetDescription(IImgDecoderFactory* this)
    def GetDescription(self):
        cdef IImgDecoderFactory* this = <IImgDecoderFactory*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDescription(this)

cdef class SRenderFactory(SObjRef):
    # IImgDecoderFactory* GetImgDecoderFactory(IRenderFactory* this)
    def GetImgDecoderFactory(self):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        return SImgDecoderFactory(<DWORD_PTR>this.lpVtbl.GetImgDecoderFactory(this))

    # void SetImgDecoderFactory(IRenderFactory* this, IImgDecoderFactory* pImgDecoderFac)
    def SetImgDecoderFactory(self, pImgDecoderFac):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetImgDecoderFactory(this, <IImgDecoderFactory*><DWORD_PTR>pImgDecoderFac.ptr())

    # BOOL CreateRenderTarget(IRenderFactory* this, IRenderTarget**ppRenderTarget, int nWid, int nHei)
    def CreateRenderTarget(self, nWid, nHei):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IRenderTarget* _ppRenderTarget
        if this.lpVtbl.CreateRenderTarget(this, &_ppRenderTarget, nWid, nHei):
            return SRenderTarget(<DWORD_PTR>_ppRenderTarget)

    # BOOL CreateFont(IRenderFactory* this, IFontS**ppFont, const LOGFONT*lf)
    def CreateFont(self, lf):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IFontS* _ppFont
        if this.lpVtbl.CreateFont(this, &_ppFont, <const LOGFONT*><DWORD_PTR>lf):
            return SFontS(<DWORD_PTR>_ppFont)

    # BOOL CreateBitmap(IRenderFactory* this, IBitmapS**ppBitmap)
    def CreateBitmap(self):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IBitmapS* _ppBitmap
        if this.lpVtbl.CreateBitmap(this, &_ppBitmap):
            return SBitmapS(<DWORD_PTR>_ppBitmap)

    # BOOL CreateRegion(IRenderFactory* this, IRegionS**ppRgn)
    def CreateRegion(self):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IRegionS* _ppRgn
        if this.lpVtbl.CreateRegion(this, &_ppRgn):
            return SRegionS(<DWORD_PTR>_ppRgn)

    # HRESULT CreateBlurMaskFilter(IRenderFactory* this, float radius, BlurStyle style, BlurFlags flag, IMaskFilter**ppMaskFilter)
    def CreateBlurMaskFilter(self, radius, style, flag):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IMaskFilter* _ppMaskFilter
        if this.lpVtbl.CreateBlurMaskFilter(this, radius, <BlurStyle>style, <BlurFlags>flag, &_ppMaskFilter) == 0:
            return SMaskFilter(<DWORD_PTR>_ppMaskFilter)

    # HRESULT CreateEmbossMaskFilter(IRenderFactory* this, float direction[3], float ambient, float specular, float blurRadius, IMaskFilter**ppMaskFilter)
    def CreateEmbossMaskFilter(self, direction, ambient, specular, blurRadius):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IMaskFilter* _ppMaskFilter
        cdef float _direction[3]
        _direction[0], _direction[1], _direction[2] = ambient
        if this.lpVtbl.CreateEmbossMaskFilter(this, _direction, ambient, specular, blurRadius, &_ppMaskFilter) == 0:
            return SMaskFilter(<DWORD_PTR>_ppMaskFilter)

    # BOOL CreatePath(IRenderFactory* this, IPathS**ppPath)
    def CreatePath(self):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IPathS* _ppPath
        if this.lpVtbl.CreatePath(this, &_ppPath):
            return SPathS(<DWORD_PTR>_ppPath)

    # BOOL CreatePathEffect(IRenderFactory* this, REFGUID guidEffect, IPathEffect**ppPathEffect)
    def CreatePathEffect(self, guidEffect):
        cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
        cdef IPathEffect* _ppPathEffect
        cdef GUID _guidEffect
        #_id.Data1, _id.Data2, _id.Data3, _id.Data4 = (0xE584B16A, 0x6BDB, 0x4afb, [0x8B,0xCC,0x3A,0x1A,0xBA,0xCD,0x2F,0xE2])
        _guidEffect.Data1, _guidEffect.Data2, _guidEffect.Data3, _guidEffect.Data4[:] = guidEffect
        if this.lpVtbl.CreatePathEffect(this, &_guidEffect, &_ppPathEffect):
            return SPathEffect(<DWORD_PTR>_ppPathEffect)

    # BOOL CreatePathMeasure(IRenderFactory* this, IPathMeasure**ppPathMeasure)
    # def CreatePathMeasure(self):
    #     cdef IRenderFactory* this = <IRenderFactory*><DWORD_PTR>self._thisptr
    #     cdef IPathMeasure* _ppPathMeasure
    #     if this.lpVtbl.CreatePathMeasure(this, &_ppPathMeasure):
    #         return SPathMeasure(<DWORD_PTR>_ppPathMeasure)

cdef class STranslatorMgr(SObjRef):
    # void SetLanguage(ITranslatorMgr* this, LPCWSTR pszLang)
    def SetLanguage(self, pszLang):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetLanguage(this, pszLang)

    # void GetLanguage(ITranslatorMgr* this, wchar_t szOut[TR_MAX_NAME_LEN])
    def GetLanguage(self):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        cdef WCHAR _szOut[64]
        this.lpVtbl.GetLanguage(this, _szOut)
        return _szOut

    # BOOL CreateTranslator(ITranslatorMgr* this, ITranslator**ppTranslator)
    def CreateTranslator(self):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        cdef ITranslator* _ppTranslator
        if this.lpVtbl.CreateTranslator(this, &_ppTranslator):
            return STranslator(<DWORD_PTR>_ppTranslator)

    # BOOL InstallTranslator(ITranslatorMgr* this, ITranslator* ppTranslator)
    def InstallTranslator(self, ppTranslator):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.InstallTranslator(this, <ITranslator*><DWORD_PTR>ppTranslator.ptr())

    # BOOL UninstallTranslator(ITranslatorMgr* this, REFGUID id)
    def UninstallTranslator(self, id):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        cdef GUID _id
        #_id.Data1, _id.Data2, _id.Data3, _id.Data4 = (0xE584B16A, 0x6BDB, 0x4afb, [0x8B,0xCC,0x3A,0x1A,0xBA,0xCD,0x2F,0xE2])
        _id.Data1, _id.Data2, _id.Data3, _id.Data4[:] = id
        return <BOOL>this.lpVtbl.UninstallTranslator(this, &_id)

    # int tr(ITranslatorMgr* this, const IStringW*strSrc, const IStringW*strCtx, wchar_t*pszOut, int nLen)
    def tr(self, strSrc, strCtx, pszOut, nLen):
        cdef ITranslatorMgr* this = <ITranslatorMgr*><DWORD_PTR>self._thisptr
        # return this.lpVtbl.tr(this, <const IStringW*>strSrc, <const IStringW*>strCtx, pszOut, nLen)

cdef class STranslator(SObjRef):
    # BOOL Load(ITranslator* this, LPVOID pData, UINT uType)
    def Load(self, pData, uType):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Load(this, <LPVOID><DWORD_PTR>pData, uType)

    # void GetName(ITranslator* this, wchar_t szBuf[TR_MAX_NAME_LEN])
    def GetName(self, szBuf):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        cdef WCHAR _szBuf[TR_MAX_NAME_LEN]
        this.lpVtbl.GetName(this, _szBuf)
        return _szBuf

    # BOOL NameEqual(ITranslator* this, LPCWSTR pszName)
    def NameEqual(self, pszName):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.NameEqual(this, pszName)

    # GUID guid(ITranslator* this)
    def guid(self):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        cdef GUID guid = this.lpVtbl.guid(this)
        return (guid.Data1, guid.Data2, guid.Data3, 
                [guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]])

    # int tr(ITranslator* this, const IStringW*strSrc, const IStringW*strCtx, wchar_t*pszOut, int nLen)
    def tr(self, strSrc, strCtx, pszOut, nLen):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        # return this.lpVtbl.tr(this, <const IStringW*>strSrc, <const IStringW*>strCtx, pszOut, nLen)

    # void getFontInfo(ITranslator* this, IStringW* strFont)
    def getFontInfo(self):
        cdef ITranslator* this = <ITranslator*><DWORD_PTR>self._thisptr
        # this.lpVtbl.getFontInfo(this, <IStringW*>strFont)

cdef class SToolTipFactory(SObjRef):
    # IToolTip* CreateToolTip(IToolTipFactory* this, HWND hHost)
    def CreateToolTip(self, hHost):
        cdef IToolTipFactory* this = <IToolTipFactory*><DWORD_PTR>self._thisptr
        cdef IToolTip* obj = this.lpVtbl.CreateToolTip(this, <HWND><DWORD_PTR>hHost)
        if obj != NULL:
            return SToolTip(<DWORD_PTR>obj)

    # void DestroyToolTip(IToolTipFactory* this, IToolTip* pToolTip)
    def DestroyToolTip(self, pToolTip):
        cdef IToolTipFactory* this = <IToolTipFactory*><DWORD_PTR>self._thisptr
        this.lpVtbl.DestroyToolTip(this, <IToolTip*><DWORD_PTR>pToolTip.ptr())

cdef class SMsgFilter(OwnerPointer):
    # BOOL PreTranslateMessage(IMsgFilter* this, MSG* pMsg)
    def PreTranslateMessage(self, pMsg):
        cdef IMsgFilter* this = <IMsgFilter*><DWORD_PTR>self._thisptr
        cdef MSG msg = MSG(<HWND><DWORD_PTR>pMsg['hwnd'], pMsg['message'], pMsg['wParam'], pMsg['lParam'], pMsg['time'], [pMsg['pt']['x'], pMsg['pt']['x']])
        return <BOOL>this.lpVtbl.PreTranslateMessage(this, &msg)

cdef class SToolTip(SMsgFilter):
    # void UpdateTip(IToolTip* this, const TIPID*id, RECT rc, LPCTSTR pszTip, int nScale)
    def UpdateTip(self, tipid, rc, pszTip, nScale):
        cdef IToolTip* this = <IToolTip*><DWORD_PTR>self._thisptr
        cdef TIPID _id = TIPID(tipid['dwHi'], tipid['dwLow'], tipid['bNcTip'])
        cdef RECT _rc = RECT(rc['left'], rc['top'], rc['right'], rc['bottom'])
        this.lpVtbl.UpdateTip(this, &_id, _rc, pszTip, nScale)

    # void ClearTip(IToolTip* this)
    def ClearTip(self):
        cdef IToolTip* this = <IToolTip*><DWORD_PTR>self._thisptr
        this.lpVtbl.ClearTip(this)

    # void RelayEvent(IToolTip* this, const MSG*pMsg)
    def RelayEvent(self, pMsg):
        cdef IToolTip* this = <IToolTip*><DWORD_PTR>self._thisptr
        cdef MSG msg = MSG(<HWND><DWORD_PTR>pMsg['hwnd'], pMsg['message'], pMsg['wParam'], pMsg['lParam'], pMsg['time'], [pMsg['pt']['x'], pMsg['pt']['x']])
        this.lpVtbl.RelayEvent(this, &msg)

cdef class SMsgLoopFactory(SObjRef):
    # HRESULT CreateMsgLoop(IMsgLoopFactory* this, IMessageLoop**ppMsgLoop, IMessageLoop *pParentLoop)
    def CreateMsgLoop(self, pParentLoop=None):
        cdef IMsgLoopFactory* this = <IMsgLoopFactory*><DWORD_PTR>self._thisptr
        cdef IMessageLoop* _ppMsgLoop
        cdef IMessageLoop* _pParentLoop = NULL
        if pParentLoop is not None:
            _pParentLoop = <IMessageLoop*><DWORD_PTR>pParentLoop.ptr()
        this.lpVtbl.CreateMsgLoop(this, &_ppMsgLoop, _pParentLoop)
        return SMessageLoop(<DWORD_PTR>_ppMsgLoop)

cdef class SMessageLoop(SObjRef):
    # BOOL AddMessageFilter(IMessageLoop* this, IMsgFilter* pMessageFilter)
    def AddMessageFilter(self, pMessageFilter):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AddMessageFilter(this, <IMsgFilter*><DWORD_PTR>pMessageFilter.ptr())

    # BOOL RemoveMessageFilter(IMessageLoop* this, IMsgFilter* pMessageFilter)
    def RemoveMessageFilter(self, pMessageFilter):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveMessageFilter(this, <IMsgFilter*><DWORD_PTR>pMessageFilter.ptr())

    # BOOL AddIdleHandler(IMessageLoop* this, IIdleHandler* pIdleHandler)
    def AddIdleHandler(self, pIdleHandler):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AddIdleHandler(this, <IIdleHandler*><DWORD_PTR>pIdleHandler.ptr())

    # BOOL RemoveIdleHandler(IMessageLoop* this, IIdleHandler* pIdleHandler)
    def RemoveIdleHandler(self, pIdleHandler):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveIdleHandler(this, <IIdleHandler*><DWORD_PTR>pIdleHandler.ptr())

    # BOOL PreTranslateMessage(IMessageLoop* this, MSG* pMsg)
    def PreTranslateMessage(self, pMsg):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        cdef MSG msg = MSG(<HWND><DWORD_PTR>pMsg['hwnd'], pMsg['message'], pMsg['wParam'], pMsg['lParam'], pMsg['time'], [pMsg['pt']['x'], pMsg['pt']['x']])
        return <BOOL>this.lpVtbl.PreTranslateMessage(this, &msg)

    # BOOL OnIdle(IMessageLoop* this, int nIdleCount)
    def OnIdle(self, nIdleCount):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.OnIdle(this, nIdleCount)

    # int Run(IMessageLoop* this)
    def Run(self):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Run(this)

    # BOOL IsRunning(IMessageLoop* this)
    def IsRunning(self):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsRunning(this)

    # void OnMsg(IMessageLoop* this, LPMSG pMsg)
    def OnMsg(self, pMsg):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnMsg(this, <LPMSG>pMsg)

    # void Quit(IMessageLoop* this, int nCode)
    def Quit(self, nCode):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        this.lpVtbl.Quit(this,nCode)

    # BOOL PostTask(IMessageLoop* this, IRunnable* runable)
    def PostTask(self, runable):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.PostTask(this, <IRunnable*><DWORD_PTR>runable.ptr())

    # int RemoveTasksForObject(IMessageLoop* this, void*pObj)
    def RemoveTasksForObject(self, pObj):
        cdef IMessageLoop* this = <IMessageLoop*><DWORD_PTR>self._thisptr
        return this.lpVtbl.RemoveTasksForObject(this, <void*><DWORD_PTR>pObj)

cdef class SIdleHandler(OwnerPointer):
    # BOOL OnIdle(IIdleHandler* this)
    def OnIdle(self):
        cdef IIdleHandler* this = <IIdleHandler*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.OnIdle(this)

cdef class SRunnable(SObjRef):
    # IRunnable* clone(IRunnable* this)
    def clone(self):
        cdef IRunnable* this = <IRunnable*><DWORD_PTR>self._thisptr
        cdef IRunnable* obj = this.lpVtbl.clone(this)
        return SRunnable(<DWORD_PTR>obj)

    # void run(IRunnable* this)
    def run(self):
        cdef IRunnable* this = <IRunnable*><DWORD_PTR>self._thisptr
        this.lpVtbl.run(this)

    # void* getObject(IRunnable* this)
    def getObject(self):
        cdef IRunnable* this = <IRunnable*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.getObject(this)

    # const char* getClassInfo(IRunnable* this)
    def getClassInfo(self):
        cdef IRunnable* this = <IRunnable*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getClassInfo(this)

cdef class SLog4zManager(SObjRef):
    # BOOL config(ILogMgr* this, const char*configPath)
    def config(self, configPath):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.config(this, configPath)

    # BOOL configFromString(ILogMgr* this, const char*configContent)
    def configFromString(self, configContent):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.configFromString(this, configContent)

    # BOOL start(ILogMgr* this)
    def start(self):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.start(this)

    # BOOL stop(ILogMgr* this)
    def stop(self):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.stop(this)

    # BOOL prePushLog(ILogMgr* this,int level)
    def prePushLog(self, id, level):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.prePushLog(this,  level)

    # BOOL pushLog(ILogMgr* this, int level, const char*filter, const char*log, const char*file, int line, const char*func, const void*pRetAddr)
    def pushLog(self, id, level, filter, log, file, line, func, pRetAddr):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.pushLog(this, level, filter, log, file, line, func, <const void*>pRetAddr)

    # BOOL isLoggerEnable(ILogMgr* this)
    def isLoggerEnable(self, enable):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isLoggerEnable(this)

    # BOOL enableLogger(ILogMgr* this,BOOL enable)
    def enableLogger(self, id, enable):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.enableLogger(this, <BOOL>enable)

    # BOOL setLoggerName(ILogMgr* this,const char*name)
    def setLoggerName(self, name):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerName(this, name)

    # BOOL setLoggerPath(ILogMgr* this, const char*path)
    def setLoggerPath(self, id, path):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerPath(this, path)

    # BOOL setLoggerLevel(ILogMgr* this, int nLevel)
    def setLoggerLevel(self, id, nLevel):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerLevel(this,  nLevel)

    # BOOL setLoggerFileLine(ILogMgr* this,BOOL enable)
    def setLoggerFileLine(self, id, enable):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerFileLine(this, <BOOL>enable)

    # BOOL setLoggerDisplay(ILogMgr* this,  BOOL enable)
    def setLoggerDisplay(self, id, enable):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerDisplay(this,  <BOOL>enable)

    # BOOL setLoggerOutFile(ILogMgr* this, BOOL enable)
    def setLoggerOutFile(self, id, enable):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerOutFile(this,  <BOOL>enable)

    # BOOL setLoggerLimitsize(ILogMgr* this, unsigned int limitsize)
    def setLoggerLimitsize(self, id, limitsize):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.setLoggerLimitsize(this, <unsigned int>limitsize)

    # void setOutputFileBuilder(ILogMgr* this, IOutputFileBuilder* pOutputFileBuilder)
    def setOutputFileBuilder(self, pOutputFileBuilder):
        cdef ILogMgr* this = <ILogMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.setOutputFileBuilder(this, <IOutputFileBuilder*><DWORD_PTR>pOutputFileBuilder.ptr())

cdef class SAttrStorageFactory(SObjRef):
    # HRESULT CreateAttrStorage(IAttrStorageFactory* this, IWindow* owner, IAttrStorage**ppAttrStorage)
    def CreateAttrStorage(self, owner):
        cdef IAttrStorageFactory* this = <IAttrStorageFactory*><DWORD_PTR>self._thisptr
        cdef IAttrStorage* _ppAttrStorage
        this.lpVtbl.CreateAttrStorage(this, <IWindow*><DWORD_PTR>owner.ptr(), &_ppAttrStorage)
        if _ppAttrStorage != NULL:
            return <DWORD_PTR>_ppAttrStorage

cdef class STaskLoop(SObjRef):
    # BOOL getName(ITaskLoop* this, char*pszBuf, int nBufLen)
    def getName(self, pszBuf, nBufLen):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getName(this, <char*>pszBuf, nBufLen)

    # void start(ITaskLoop* this, const char*pszName, Priority priority)
    def start(self, pszName, priority):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        this.lpVtbl.start(this, pszName, <Priority>priority)

    # void stop(ITaskLoop* this)
    def stop(self):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        this.lpVtbl.stop(this)

    # long postTask(ITaskLoop* this, const IRunnable*runnable, BOOL waitUntilDone, int priority)
    def postTask(self, runnable, waitUntilDone, priority):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return this.lpVtbl.postTask(this, <const IRunnable*><DWORD_PTR>runnable.ptr(), <BOOL>waitUntilDone, priority)

    # void cancelTasksForObject(ITaskLoop* this, void*object)
    def cancelTasksForObject(self, object):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        this.lpVtbl.cancelTasksForObject(this, <void*><DWORD_PTR>object)

    # BOOL cancelTask(ITaskLoop* this, long taskId)
    def cancelTask(self, taskId):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.cancelTask(this, taskId)

    # int getTaskCount(ITaskLoop* this)
    def getTaskCount(self):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getTaskCount(this)

    # BOOL isRunning(ITaskLoop* this)
    def isRunning(self):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isRunning(this)

    # BOOL getRunningTaskInfo(ITaskLoop* this, char*buf, int bufLen)
    def getRunningTaskInfo(self, buf, bufLen):
        cdef ITaskLoop* this = <ITaskLoop*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getRunningTaskInfo(this, <char*>buf, bufLen)

cdef class SRealWndHandler(SObjRef):
    # HWND OnRealWndCreate(IRealWndHandler* this, IWindow* pRealWnd)
    def OnRealWndCreate(self, pRealWnd):
        cdef IRealWndHandler* this = <IRealWndHandler*><DWORD_PTR>self._thisptr
        # return <DWORD_PTR>this.lpVtbl.OnRealWndCreate(this, <IWindow*>pRealWnd)

    # void OnRealWndDestroy(IRealWndHandler* this, IWindow* pRealWnd)
    def OnRealWndDestroy(self, pRealWnd):
        cdef IRealWndHandler* this = <IRealWndHandler*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnRealWndDestroy(this, <IWindow*>pRealWnd)

    # BOOL OnRealWndInit(IRealWndHandler* this, IWindow* pRealWnd)
    def OnRealWndInit(self, pRealWnd):
        cdef IRealWndHandler* this = <IRealWndHandler*><DWORD_PTR>self._thisptr
        # return <BOOL>this.lpVtbl.OnRealWndInit(this, <IWindow*>pRealWnd)

    # BOOL OnRealWndSize(IRealWndHandler* this, IWindow* pRealWnd)
    def OnRealWndSize(self, pRealWnd):
        cdef IRealWndHandler* this = <IRealWndHandler*><DWORD_PTR>self._thisptr
        # return <BOOL>this.lpVtbl.OnRealWndSize(this, <IWindow*>pRealWnd)

    # BOOL OnRealWndPosition(IRealWndHandler* this, IWindow* pRealWnd, RECT rcWnd)
    def OnRealWndPosition(self, pRealWnd):
        cdef IRealWndHandler* this = <IRealWndHandler*><DWORD_PTR>self._thisptr
        cdef RECT _rcWnd
        # return <BOOL>this.lpVtbl.OnRealWndPosition(this, <IWindow*>pRealWnd, &_rcWnd)

cdef class SScriptFactory(SObjRef):
    # HRESULT CreateScriptModule(IScriptFactory* this, IScriptModule**ppScriptModule)
    def CreateScriptModule(self):
        cdef IScriptFactory* this = <IScriptFactory*><DWORD_PTR>self._thisptr
        cdef IScriptModule* _ppScriptModule
        this.lpVtbl.CreateScriptModule(this, &_ppScriptModule)
        if _ppScriptModule != NULL:
            return SScriptModule(<DWORD_PTR>_ppScriptModule)

cdef class SScriptModule(SObjRef):
    # void* GetScriptEngine(IScriptModule* this)
    def GetScriptEngine(self):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetScriptEngine(this)

    # void executeScriptFile(IScriptModule* this, LPCSTR pszScriptFile)
    def executeScriptFile(self, pszScriptFile):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        this.lpVtbl.executeScriptFile(this, pszScriptFile)

    # void executeScriptBuffer(IScriptModule* this, LPCSTR buff, size_t sz)
    def executeScriptBuffer(self, buff):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        this.lpVtbl.executeScriptBuffer(this, buff, len(buff))

    # BOOL executeScriptedEventHandler(IScriptModule* this, LPCSTR handler_name, IEvtArgs* pEvt)
    def executeScriptedEventHandler(self, handler_name, pEvt):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.executeScriptedEventHandler(this, handler_name, <IEvtArgs*><DWORD_PTR>pEvt.ptr())

    # int executeMain(IScriptModule* this, HINSTANCE hInst, LPCSTR pszWorkDir, LPCSTR pszArgs)
    def executeMain(self, hInst, pszWorkDir, pszArgs):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        return this.lpVtbl.executeMain(this, <HINSTANCE><DWORD_PTR>hInst, pszWorkDir, pszArgs)

    # LPCSTR getIdentifierString(IScriptModule* this)
    def getIdentifierString(self):
        cdef IScriptModule* this = <IScriptModule*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getIdentifierString(this)

cdef class SAnimation(SObject):
    # IAnimation* clone(IAnimation* this)
    def clone(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        cdef IAnimation* obj = this.lpVtbl.clone(this)
        if obj != NULL:
            return SAnimation(<DWORD_PTR>obj)

    # void copy(IAnimation* this, const IAnimation*src)
    def copy(self, src):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.copy(this, <const IAnimation*><DWORD_PTR>src.ptr())

    # void reset(IAnimation* this)
    def reset(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.reset(this)

    # void cancel(IAnimation* this)
    def cancel(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.cancel(this)

    # void setInterpolator(IAnimation* this, IInterpolator* i)
    def setInterpolator(self, i):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setInterpolator(this, <IInterpolator*><DWORD_PTR>i.ptr())

    # void setDuration(IAnimation* this, long durationMillis)
    def setDuration(self, durationMillis):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setDuration(this, durationMillis)

    # void scaleCurrentDuration(IAnimation* this, float scale)
    def scaleCurrentDuration(self, scale):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.scaleCurrentDuration(this, scale)

    # void setFillBefore(IAnimation* this, BOOL bFill)
    def setFillBefore(self, bFill):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setFillBefore(this, <BOOL>bFill)

    # void setFillAfter(IAnimation* this, BOOL bFill)
    def setFillAfter(self, bFill):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setFillAfter(this, <BOOL>bFill)

    # BOOL getFillBefore(IAnimation* this)
    def getFillBefore(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getFillBefore(this)

    # BOOL getFillAfter(IAnimation* this)
    def getFillAfter(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getFillAfter(this)

    # void setStartOffset(IAnimation* this, long offset)
    def setStartOffset(self, offset):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setStartOffset(this, offset)

    # BOOL isFillEnabled(IAnimation* this)
    def isFillEnabled(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isFillEnabled(this)

    # void setFillEnabled(IAnimation* this, BOOL fillEnabled)
    def setFillEnabled(self, fillEnabled):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setFillEnabled(this, <BOOL>fillEnabled)

    # void setStartTime(IAnimation* this, int64_t startTimeMillis)
    def setStartTime(self, startTimeMillis):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setStartTime(this, startTimeMillis)

    # void start(IAnimation* this)
    def start(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.start(this)

    # void startNow(IAnimation* this)
    def startNow(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.startNow(this)

    # void setRepeatMode(IAnimation* this, RepeatMode repeatMode)
    def setRepeatMode(self, repeatMode):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRepeatMode(this, <RepeatMode>repeatMode)

    # void setRepeatCount(IAnimation* this, int repeatCount)
    def setRepeatCount(self, repeatCount):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRepeatCount(this, repeatCount)

    # void setZAdjustment(IAnimation* this, ZAdjustment zAdjustment)
    def setZAdjustment(self, zAdjustment):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setZAdjustment(this, <ZAdjustment>zAdjustment)

    # IInterpolator* getInterpolator(IAnimation* this)
    def getInterpolator(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        cdef IInterpolator* obj = this.lpVtbl.getInterpolator(this)
        if obj != NULL:
            return SInterpolator(<DWORD_PTR>obj)

    # int64_t getStartTime(IAnimation* this)
    def getStartTime(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getStartTime(this)

    # long getDuration(IAnimation* this)
    def getDuration(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getDuration(this)

    # long getStartOffset(IAnimation* this)
    def getStartOffset(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getStartOffset(this)

    # RepeatMode getRepeatMode(IAnimation* this)
    def getRepeatMode(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getRepeatMode(this)

    # int getRepeatCount(IAnimation* this)
    def getRepeatCount(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getRepeatCount(this)

    # ZAdjustment getZAdjustment(IAnimation* this)
    def getZAdjustment(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getZAdjustment(this)

    # void setAnimationListener(IAnimation* this, IAnimationListener* listener)
    def setAnimationListener(self, listener):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setAnimationListener(this, <IAnimationListener*><DWORD_PTR>listener.ptr())

    # long computeDurationHint(IAnimation* this)
    def computeDurationHint(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.computeDurationHint(this)

    # BOOL getTransformation2(IAnimation* this, uint64_t currentTime, ITransformation* outTransformation, float scale)
    def getTransformation2(self, currentTime, outTransformation, scale):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getTransformation2(this, currentTime, <ITransformation*><DWORD_PTR>outTransformation.ptr(), scale)

    # BOOL getTransformation(IAnimation* this, int64_t currentTime, ITransformation* outTransformation)
    def getTransformation(self, currentTime, outTransformation):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.getTransformation(this, currentTime, <ITransformation*><DWORD_PTR>outTransformation.ptr())

    # BOOL hasStarted(IAnimation* this)
    def hasStarted(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.hasStarted(this)

    # BOOL hasEnded(IAnimation* this)
    def hasEnded(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.hasEnded(this)

    # void applyTransformation(IAnimation* this, float interpolatedTime, ITransformation*t)
    def applyTransformation(self, interpolatedTime, t):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.applyTransformation(this, interpolatedTime, <ITransformation*><DWORD_PTR>t.ptr())

    # BOOL hasAlpha(IAnimation* this)
    def hasAlpha(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.hasAlpha(this)

    # void initialize(IAnimation* this, int width, int height, int parentWidth, int parentHeight, int nScale)
    def initialize(self, width, height, parentWidth, parentHeight, nScale):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.initialize(this, width, height, parentWidth, parentHeight,nScale)

    # void setUserData(IAnimation* this, ULONG_PTR data)
    def setUserData(self, data):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        this.lpVtbl.setUserData(this, data)

    # ULONG_PTR getUserData(IAnimation* this)
    def getUserData(self):
        cdef IAnimation* this = <IAnimation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getUserData(this)

cdef class SAnimationListener(OwnerPointer):
    # void OnAnimationStart(IAnimationListener* this, IAnimation* animation)
    def OnAnimationStart(self, animation):
        cdef IAnimationListener* this = <IAnimationListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnAnimationStart(this, <IAnimation*>animation)

    # void OnAnimationStop(IAnimationListener* this, IAnimation* animation)
    def OnAnimationStop(self, animation):
        cdef IAnimationListener* this = <IAnimationListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnAnimationStop(this, <IAnimation*>animation)

    # void OnAnimationRepeat(IAnimationListener* this, IAnimation* animation)
    def OnAnimationRepeat(self, animation):
        cdef IAnimationListener* this = <IAnimationListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnAnimationRepeat(this, <IAnimation*>animation)

cdef class STransformation(OwnerPointer):
    # IMatrix* GetMatrix(ITransformation* this)
    def GetMatrix(self):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        cdef IMatrix* obj = this.lpVtbl.GetMatrix(this)
        if obj != NULL:
            return SMatrix(<DWORD_PTR>obj)

    # BYTE GetAlpha(ITransformation* this)
    def GetAlpha(self):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetAlpha(this)

    # void SetAlpha(ITransformation* this, BYTE alpha)
    def SetAlpha(self, alpha):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAlpha(this, <BYTE>alpha)

    # void Clear(ITransformation* this)
    def Clear(self):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        this.lpVtbl.Clear(this)

    # void SetTransformationType(ITransformation* this, int type)
    def SetTransformationType(self, type):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetTransformationType(this, type)

    # void Compose(const ITransformation*t)
    def Compose(self, t):
        cdef ITransformation* this = <ITransformation*><DWORD_PTR>self._thisptr
        this.lpVtbl.Compose(<ITransformation*><DWORD_PTR>t.ptr())

cdef class SInterpolator(SObject):
    # float getInterpolation(IInterpolator* this, float input)
    def getInterpolation(self, input):
        cdef IInterpolator* this = <IInterpolator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getInterpolation(this, input)

cdef class SValueAnimator(SObject):
    # void setDuration(IValueAnimator* this, long duration)
    def setDuration(self, duration):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setDuration(this, duration)

    # long getDuration(IValueAnimator* this)
    def getDuration(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getDuration(this)

    # long getTotalDuration(IValueAnimator* this)
    def getTotalDuration(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getTotalDuration(this)

    # void setCurrentPlayTime(IValueAnimator* this, long playTime)
    def setCurrentPlayTime(self, playTime):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setCurrentPlayTime(this, playTime)

    # void setCurrentFraction(IValueAnimator* this, float fraction)
    def setCurrentFraction(self, fraction):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setCurrentFraction(this, fraction)

    # long getCurrentPlayTime(IValueAnimator* this)
    def getCurrentPlayTime(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getCurrentPlayTime(this)

    # long getStartDelay(IValueAnimator* this)
    def getStartDelay(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getStartDelay(this)

    # void setStartDelay(IValueAnimator* this, long startDelay)
    def setStartDelay(self, startDelay):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setStartDelay(this, startDelay)

    # void setRepeatCount(IValueAnimator* this, int value)
    def setRepeatCount(self, value):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRepeatCount(this, value)

    # int getRepeatCount(IValueAnimator* this)
    def getRepeatCount(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getRepeatCount(this)

    # void setRepeatMode(IValueAnimator* this, RepeatMode value)
    def setRepeatMode(self, value):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRepeatMode(this, <RepeatMode>value)

    # RepeatMode getRepeatMode(IValueAnimator* this)
    def getRepeatMode(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getRepeatMode(this)

    # void addUpdateListener(IValueAnimator* this, IAnimatorUpdateListener* listener)
    def addUpdateListener(self, listener):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.addUpdateListener(this, <IAnimatorUpdateListener*><DWORD_PTR>listener.ptr())

    # void removeAllUpdateListeners(IValueAnimator* this)
    def removeAllUpdateListeners(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.removeAllUpdateListeners(this)

    # void removeUpdateListener(IValueAnimator* this, IAnimatorUpdateListener* listener)
    def removeUpdateListener(self, listener):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.removeUpdateListener(this, <IAnimatorUpdateListener*><DWORD_PTR>listener.ptr())

    # void setInterpolator(IValueAnimator* this, IInterpolator* value)
    def setInterpolator(self, value):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.setInterpolator(this, <IInterpolator*>value)

    # IInterpolator* getInterpolator(IValueAnimator* this)
    def getInterpolator(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        cdef IInterpolator* obj = this.lpVtbl.getInterpolator(this)
        if obj != NULL:
            return SInterpolator(<DWORD_PTR>obj)

    # void addListener(IValueAnimator* this, IAnimatorListener* p)
    def addListener(self, p):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.addListener(this, <IAnimatorListener*><DWORD_PTR>p.ptr())

    # void removeListener(IValueAnimator* this, IAnimatorListener* p)
    def removeListener(self, p):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.removeListener(this, <IAnimatorListener*><DWORD_PTR>p.ptr())

    # void start(IValueAnimator* this, ITimelineHandlersMgr* pContainer)
    def start(self, pContainer):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.start(this, <ITimelineHandlersMgr*><DWORD_PTR>pContainer.ptr())

    # void end(IValueAnimator* this)
    def end(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.end(this)

    # BOOL isRunning(IValueAnimator* this)
    def isRunning(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isRunning(this)

    # BOOL isStarted(IValueAnimator* this)
    def isStarted(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isStarted(this)

    # void reverse(IValueAnimator* this)
    def reverse(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.reverse(this)

    # void commitAnimationFrame(IValueAnimator* this, long frameTime)
    def commitAnimationFrame(self, frameTime):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.commitAnimationFrame(this, frameTime)

    # float getAnimatedFraction(IValueAnimator* this)
    def getAnimatedFraction(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getAnimatedFraction(this)

    # IValueAnimator* clone(IValueAnimator* this)
    def clone(self):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        cdef IValueAnimator* obj = this.lpVtbl.clone(this)
        if obj != NULL:
            return SValueAnimator(<DWORD_PTR>obj)

    # void onEvaluateValue(IValueAnimator* this, float fraction)
    def onEvaluateValue(self, fraction):
        cdef IValueAnimator* this = <IValueAnimator*><DWORD_PTR>self._thisptr
        this.lpVtbl.onEvaluateValue(this, fraction)

cdef class SAnimatorUpdateListener(OwnerPointer):
    # void onAnimationUpdate(IAnimatorUpdateListener* this, IValueAnimator* pAnimator)
    def onAnimationUpdate(self, pAnimator):
        cdef IAnimatorUpdateListener* this = <IAnimatorUpdateListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.onAnimationUpdate(this, <IValueAnimator*>pAnimator)

cdef class SAnimatorListener(OwnerPointer):
    # void onAnimationStart(IAnimatorListener* this, IValueAnimator* pAnimator)
    def onAnimationStart(self, pAnimator):
        cdef IAnimatorListener* this = <IAnimatorListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.onAnimationStart(this, <IValueAnimator*>pAnimator)

    # void onAnimationEnd(IAnimatorListener* this, IValueAnimator* pAnimator)
    def onAnimationEnd(self, pAnimator):
        cdef IAnimatorListener* this = <IAnimatorListener*><DWORD_PTR>self._thisptr
        # #this.lpVtbl.onAnimationEnd(this, <IValueAnimator*>pAnimator)

    # void onAnimationRepeat(IAnimatorListener* this, IValueAnimator* pAnimator)
    def onAnimationRepeat(self, pAnimator):
        cdef IAnimatorListener* this = <IAnimatorListener*><DWORD_PTR>self._thisptr
        # this.lpVtbl.onAnimationRepeat(this, <IValueAnimator*>pAnimator)

cdef class STimelineHandlersMgr(OwnerPointer):
    # BOOL RegisterTimelineHandler(ITimelineHandlersMgr* this, ITimelineHandler* pHandler)
    def RegisterTimelineHandler(self, pHandler):
        cdef ITimelineHandlersMgr* this = <ITimelineHandlersMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RegisterTimelineHandler(this, <ITimelineHandler*><DWORD_PTR>pHandler.ptr())

    # BOOL UnregisterTimelineHandler(ITimelineHandlersMgr* this, ITimelineHandler* pHandler)
    def UnregisterTimelineHandler(self, pHandler):
        cdef ITimelineHandlersMgr* this = <ITimelineHandlersMgr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnregisterTimelineHandler(this, <ITimelineHandler*><DWORD_PTR>pHandler.ptr())

cdef class STimelineHandler(OwnerPointer):
    # void OnNextFrame(ITimelineHandler* this)
    def OnNextFrame(self):
        cdef ITimelineHandler* this = <ITimelineHandler*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnNextFrame(this)

cdef class SImgFrame(OwnerPointer):
    # BOOL GetSize(IImgFrame* this, UINT* pWid, UINT* pHei)
    def GetSize(self, pWid, pHei):
        cdef IImgFrame* this = <IImgFrame*><DWORD_PTR>self._thisptr
        cdef UINT wid, hei
        if this.lpVtbl.GetSize(this, &wid, &hei):
            return {'cx': wid, 'cy': hei}

    # const VOID* GetPixels(const IImgFrame* this)
    def GetPixels(self):
        cdef IImgFrame* this = <IImgFrame*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPixels(this)

    # int GetDelay(IImgFrame* this)
    def GetDelay(self):
        cdef IImgFrame* this = <IImgFrame*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDelay(this)

cdef class SMaskFilter(SObjRef):
    # void* GetPtr(IMaskFilter* this)
    def GetPtr(self):
        cdef IMaskFilter* this = <IMaskFilter*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPtr(this)

# cdef class SPathMeasure(SObjRef):
#     # void setPath(IPathMeasure* this, IPathS* path, BOOL forceClosed)
#     def setPath(self, path, forceClosed):
#         cdef IPathMeasure* this = <IPathMeasure*><DWORD_PTR>self._thisptr
#         this.lpVtbl.setPath(this, <IPathS*><DWORD_PTR>path.ptr(), <BOOL>forceClosed)
#
#     # float getLength(IPathMeasure* this)
#     def getLength(self):
#         cdef IPathMeasure* this = <IPathMeasure*><DWORD_PTR>self._thisptr
#         return this.lpVtbl.getLength(this)
#
#     # BOOL getPosTan(IPathMeasure* this, float distance, float pos[], float tan[])
#     def getPosTan(self, distance, pos, tan):
#         cdef IPathMeasure* this = <IPathMeasure*><DWORD_PTR>self._thisptr
#         cdef float _pos[2]
#         cdef float _tan[2]
#         _pos[0], _pos[1] = pos[0], pos[1]
#         _tan[0], _tan[1] = tan[0], tan[1]
#         return <BOOL>this.lpVtbl.getPosTan(this, distance, _pos, _tan)
#
#     # BOOL getSegment(IPathMeasure* this, float startD, float stopD, IPathS*dst, BOOL startWithMoveTo)
#     def getSegment(self, startD, stopD, dst, startWithMoveTo):
#         cdef IPathMeasure* this = <IPathMeasure*><DWORD_PTR>self._thisptr
#         return <BOOL>this.lpVtbl.getSegment(this, startD, stopD, <IPathS*><DWORD_PTR>dst.ptr(), <BOOL>startWithMoveTo)

cdef class SSwndContainer(STimelineHandlersMgr):
    # BOOL RegisterTimelineHandler(ISwndContainer* this, ITimelineHandler* pHandler)
    def RegisterTimelineHandler(self, pHandler):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RegisterTimelineHandler(this, <ITimelineHandler*><DWORD_PTR>pHandler.ptr())

    # BOOL UnregisterTimelineHandler(ISwndContainer* this, ITimelineHandler* pHandler)
    def UnregisterTimelineHandler(self, pHandler):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnregisterTimelineHandler(this, <ITimelineHandler*><DWORD_PTR>pHandler.ptr())

    # BOOL RegisterDragDrop(ISwndContainer* this, SWND swnd, IDropTarget* pDropTarget)
    def RegisterDragDrop(self, swnd, pDropTarget):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RegisterDragDrop(this, <SWND>swnd, <IDropTarget*><DWORD_PTR>pDropTarget.ptr())

    # BOOL UnregisterDragDrop(ISwndContainer* this, SWND swnd)
    def UnregisterDragDrop(self, swnd):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnregisterDragDrop(this, <SWND>swnd)

    # BOOL OnFireEvent(ISwndContainer* this, IEvtArgs* evt)
    def OnFireEvent(self, evt):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.OnFireEvent(this, <IEvtArgs*><DWORD_PTR>evt.ptr())

    # IMessageLoop* GetMsgLoop(ISwndContainer* this)
    def GetMsgLoop(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef IMessageLoop* obj = this.lpVtbl.GetMsgLoop(this)
        if obj != NULL:
            return SMessageLoop(<DWORD_PTR>obj)

    # IScriptModule* GetScriptModule(ISwndContainer* this)
    def GetScriptModule(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef IScriptModule* obj = this.lpVtbl.GetScriptModule(this)
        if obj != NULL:
            return SScriptModule(<DWORD_PTR>obj)

    # ICaret* GetCaret(ISwndContainer* this)  # Method not available in SOUI5
    # def GetCaret(self):
    #     cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
    #     cdef ICaret* obj = this.lpVtbl.GetCaret(this)
    #     if obj != NULL:
    #         return SCaret(<DWORD_PTR>obj)

    # HWND GetHostHwnd(ISwndContainer* this)
    def GetHostHwnd(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetHostHwnd(this)

    # BOOL IsTranslucent(const ISwndContainer* this)
    def IsTranslucent(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsTranslucent(this)

    # BOOL IsSendWheel2Hover(const ISwndContainer* this)
    def IsSendWheel2Hover(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsSendWheel2Hover(this)

    # int GetScale(const ISwndContainer* this)
    def GetScale(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScale(this)

    # LPCWSTR GetTranslatorContext(const ISwndContainer* this)
    def GetTranslatorContext(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTranslatorContext(this)

    # void GetContainerRect(const ISwndContainer* this, RECT *prc)
    def GetContainerRect(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef RECT _rc
        this.lpVtbl.GetContainerRect(this, &_rc)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

    # void UpdateRegion(ISwndContainer* this, IRegionS* rgn)
    def UpdateRegion(self, rgn):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.UpdateRegion(this, <IRegionS*><DWORD_PTR>rgn.ptr())

    # IRenderTarget* OnGetRenderTarget(ISwndContainer* this, LPCRECT rc, GrtFlag gdcFlags)  # Method not available in SOUI5
    # def OnGetRenderTarget(self, rc, gdcFlags):
    #     cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
    #     cdef RECT _rc
    #     cdef IRenderTarget* obj = this.lpVtbl.OnGetRenderTarget(this, &_rc, <GrtFlag>gdcFlags)
    #     if obj != NULL:
    #         return SRenderTarget(<DWORD_PTR>obj)

    # void OnReleaseRenderTarget(ISwndContainer* this, IRenderTarget* pRT, LPCRECT rc, GrtFlag gdcFlags)  # Method not available in SOUI5
    # def OnReleaseRenderTarget(self, pRT, rc, gdcFlags):
    #     cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
    #     cdef RECT _rc = RECT(rc['left'], rc['top'], rc['right'], rc['bottom'])
    #     this.lpVtbl.OnReleaseRenderTarget(this, <IRenderTarget*><DWORD_PTR>pRT.ptr(), &_rc, <GrtFlag>gdcFlags)

    # void OnRedraw(ISwndContainer* this, LPCRECT rc, BOOL bClip)
    def OnRedraw(self, rc, bClip=True):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef RECT _rc = RECT(rc['left'], rc['top'], rc['right'], rc['bottom'])
        this.lpVtbl.OnRedraw(this, &_rc, <BOOL>bClip)

    # SWND OnGetSwndCapture(const ISwndContainer* this)
    def OnGetSwndCapture(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.OnGetSwndCapture(this)

    # SWND OnSetSwndCapture(ISwndContainer* this, SWND swnd)
    def OnSetSwndCapture(self, swnd):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.OnSetSwndCapture(this, <SWND>swnd)

    # BOOL OnReleaseSwndCapture(ISwndContainer* this)
    def OnReleaseSwndCapture(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.OnReleaseSwndCapture(this)

    # SWND GetHover(const ISwndContainer* this)
    def GetHover(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetHover(this)

    # SWND GetFocus(const ISwndContainer* this)
    def GetFocus(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetFocus(this)

    # void OnSetSwndFocus(ISwndContainer* this, SWND swnd)
    def OnSetSwndFocus(self, swnd):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnSetSwndFocus(this, <SWND>swnd)

    # BOOL UpdateWindow(ISwndContainer* this, BOOL bForce)
    def UpdateWindow(self, bForce=False):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UpdateWindow(this, <BOOL>bForce)

    # void UpdateTooltip(ISwndContainer* this)
    def UpdateTooltip(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.UpdateTooltip(this)

    # void FrameToHost(const ISwndContainer* this, RECT* rc)
    def FrameToHost(self, rc):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef RECT _rc = RECT(rc['left'], rc['top'], rc['right'], rc['bottom'])
        this.lpVtbl.FrameToHost(this, &_rc)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

    # IAcceleratorMgr* GetAcceleratorMgr(ISwndContainer* this)
    def GetAcceleratorMgr(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        cdef IAcceleratorMgr* obj = this.lpVtbl.GetAcceleratorMgr(this)
        if obj != NULL:
            return SAcceleratorMgr(<DWORD_PTR>obj)

    # BOOL RegisterTrackMouseEvent(ISwndContainer* this, SWND swnd)
    def RegisterTrackMouseEvent(self, swnd):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RegisterTrackMouseEvent(this, <SWND>swnd)

    # BOOL UnregisterTrackMouseEvent(ISwndContainer* this, SWND swnd)
    def UnregisterTrackMouseEvent(self, swnd):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnregisterTrackMouseEvent(this, <SWND>swnd)

    # void MarkWndTreeZorderDirty(ISwndContainer* this)
    def MarkWndTreeZorderDirty(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.MarkWndTreeZorderDirty(this)

    # void BuildWndTreeZorder(ISwndContainer* this)
    def BuildWndTreeZorder(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.BuildWndTreeZorder(this)

    # void EnableIME(ISwndContainer* this, BOOL bEnable)
    def EnableIME(self, bEnable):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnableIME(this, <BOOL>bEnable)

    # void OnUpdateCursor(ISwndContainer* this)
    def OnUpdateCursor(self):
        cdef ISwndContainer* this = <ISwndContainer*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnUpdateCursor(this)

cdef class SCaret(SObject):
    # BOOL Init(ICaret* this, HBITMAP hBmp, int nWid, int nHei)
    def Init(self, hBmp, nWid, nHei):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Init(this, <HBITMAP><DWORD_PTR>hBmp, nWid, nHei)

    # void SetPosition(ICaret* this, int x, int y)
    def SetPosition(self, x, y):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetPosition(this, x, y)

    # BOOL SetVisible(ICaret* this, BOOL bVisible, SWND owner)
    def SetVisible(self, bVisible, owner):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetVisible(this, <BOOL>bVisible, <SWND>owner)

    # BOOL IsVisible(const ICaret* this)
    def IsVisible(self):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsVisible(this)

    # void Draw(ICaret* this, IRenderTarget* pRT)
    def Draw(self, pRT):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        this.lpVtbl.Draw(this, <IRenderTarget*><DWORD_PTR>pRT.ptr())

    # RECT GetRect(const ICaret* this)
    def GetRect(self):
        cdef ICaret* this = <ICaret*><DWORD_PTR>self._thisptr
        cdef RECT _rc = this.lpVtbl.GetRect(this)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

cdef class SAcceleratorMgr(OwnerPointer):
    # void RegisterAccelerator(IAcceleratorMgr* this, const IAccelerator*pAcc, IAcceleratorTarget*target)
    def RegisterAccelerator(self, pAcc, target):
        cdef IAcceleratorMgr* this = <IAcceleratorMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.RegisterAccelerator(this, <const IAccelerator*>pAcc, <IAcceleratorTarget*><DWORD_PTR>target.ptr())

    # void UnregisterAccelerator(IAcceleratorMgr* this, const IAccelerator*pAcc, IAcceleratorTarget*target)
    def UnregisterAccelerator(self, pAcc, target):
        cdef IAcceleratorMgr* this = <IAcceleratorMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.UnregisterAccelerator(this, <const IAccelerator*>pAcc, <IAcceleratorTarget*><DWORD_PTR>target.ptr())

    # void UnregisterAccelerators(IAcceleratorMgr* this, IAcceleratorTarget* target)
    def UnregisterAccelerators(self, target):
        cdef IAcceleratorMgr* this = <IAcceleratorMgr*><DWORD_PTR>self._thisptr
        this.lpVtbl.UnregisterAccelerators(this, <IAcceleratorTarget*><DWORD_PTR>target.ptr())

cdef class SAccelerator(OwnerPointer):
    # WORD GetModifier(const IAccelerator* this)
    def GetModifier(self):
        cdef IAccelerator* this = <IAccelerator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetModifier(this)

    # WORD GetKey(const IAccelerator* this)
    def GetKey(self):
        cdef IAccelerator* this = <IAccelerator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetKey(this)

    # DWORD GetAcc(const IAccelerator* this)
    def GetAcc(self):
        cdef IAccelerator* this = <IAccelerator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetAcc(this)

cdef class SAcceleratorTarget(OwnerPointer):
    # BOOL OnAcceleratorPressed(IAcceleratorTarget* this, const IAccelerator*acc)
    def OnAcceleratorPressed(self, acc):
        cdef IAcceleratorTarget* this = <IAcceleratorTarget*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.OnAcceleratorPressed(this, <const IAccelerator*><DWORD_PTR>acc.ptr())

cdef class SMatrix(OwnerPointer):
    # IxForm* Data(const IMatrix* this)
    def Data(self):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        cdef IxForm* obj = this.lpVtbl.Data(this)
        if obj != NULL:
            result = []
            for idx in range(9):
                result.append(obj.fMat[idx])
            return result

    # void reset(IMatrix* this)
    def reset(self):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.reset(this)

    # void setIdentity(IMatrix* this)
    def setIdentity(self):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setIdentity(this)

    # BOOL isIdentity(const IMatrix* this)
    def isIdentity(self):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isIdentity(this)

    # void setTranslate(IMatrix* this, float dx, float dy)
    def setTranslate(self, dx, dy):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setTranslate(this, dx, dy)

    # void setScale(IMatrix* this, float sx, float sy)
    def setScale(self, sx, sy):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setScale(this, sx, sy)

    # void setScale2(IMatrix* this, float sx, float sy, float px, float py)
    def setScale2(self, sx, sy, px, py):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setScale2(this, sx, sy, px, py)

    # void setRotate(IMatrix* this, float degrees)
    def setRotate(self, degrees):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRotate(this, degrees)

    # void setRotate2(IMatrix* this, float degrees, float px, float py)
    def setRotate2(self, degrees, px, py):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setRotate2(this, degrees, px, py)

    # void setSkew(IMatrix* this, float kx, float ky)
    def setSkew(self, kx, ky):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setSkew(this, kx, ky)

    # void setSkew2(IMatrix* this, float kx, float ky, float px, float py)
    def setSkew2(self, kx, ky, px, py):
        cdef IMatrix* this = <IMatrix*><DWORD_PTR>self._thisptr
        this.lpVtbl.setSkew2(this, kx, ky, px, py)

cdef class SNcPainter(SObject):
    # IWindow* GetRoot(INcPainter* this)
    def GetRoot(self):
        cdef INcPainter* this = <INcPainter*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetRoot(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

cdef class SXmlDoc(SObjRef):
    # LPVOID GetPrivPtr(const IXmlDoc* this)
    def GetPrivPtr(self):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPrivPtr(this)

    # void Reset(IXmlDoc* this)
    def Reset(self):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        this.lpVtbl.Reset(this)

    # void Copy(IXmlDoc* this, const IXmlDoc* proto)
    def Copy(self, proto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        this.lpVtbl.Copy(this, <IXmlDoc*><DWORD_PTR>proto)

    # BOOL LoadString(IXmlDoc* this, const wchar_t* contents, unsigned int options)
    def LoadString(self, contents, options=XmlParseOpt.xml_parse_default):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadString(this, contents, <unsigned int>options)

    # BOOL LoadFileW(IXmlDoc* this, const wchar_t* path, unsigned int options , XmlEncoding encoding)
    def LoadFile(self, path, options=XmlParseOpt.xml_parse_default, encoding=XmlEncoding.enc_auto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadFileW(this, path, <unsigned int>options, <XmlEncoding>encoding)

    # BOOL LoadBuffer(IXmlDoc* this, const void* contents, size_t size, unsigned int options , XmlEncoding encoding)
    def LoadBuffer(self, contents, size, options=XmlParseOpt.xml_parse_default, encoding=XmlEncoding.enc_auto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadBuffer(this, <const void*>contents, size, <unsigned int>options, <XmlEncoding>encoding)

    # BOOL LoadBufferInplace(IXmlDoc* this, void* contents, size_t size, unsigned int options , XmlEncoding encoding)
    def LoadBufferInplace(self, contents, size, options=XmlParseOpt.xml_parse_default, encoding=XmlEncoding.enc_auto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadBufferInplace(this, <void*><DWORD_PTR>contents, size, <unsigned int>options, <XmlEncoding>encoding)

    # BOOL LoadBufferInplaceOwn(IXmlDoc* this, void* contents, size_t size, unsigned int options , XmlEncoding encoding )
    def LoadBufferInplaceOwn(self, contents, size, options=XmlParseOpt.xml_parse_default, encoding=XmlEncoding.enc_auto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadBufferInplaceOwn(this, <void*><DWORD_PTR>contents, size, <unsigned int>options, <XmlEncoding>encoding)

    # void GetParseResult(const IXmlDoc* this, XmlParseResult*pResult)
    def GetParseResult(self):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        cdef XmlParseResult result
        this.lpVtbl.GetParseResult(this, &result)
        return {'status': result.status, 'offset': result.offset, 'encoding': result.encoding}

    # void SaveBinary(const IXmlDoc* this, FILE*f)
    def SaveBinary(self, f):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        this.lpVtbl.SaveBinary(this, <FILE*><DWORD_PTR>f)

    # BOOL SaveFileW(const IXmlDoc* this, const wchar_t* path, const wchar_t* indent , unsigned int flags, XmlEncoding encoding)
    def SaveFile(self, path, indent, flags, encoding=XmlEncoding.enc_auto):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SaveFileW(this, path, indent, flags, <XmlEncoding>encoding)

    # IXmlNode* Root(const IXmlDoc* this)
    def Root(self):
        cdef IXmlDoc* this = <IXmlDoc*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.Root(this)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

cdef class SXmlNode(SObjRef):
    # void ToString(const IXmlNode* this, IStringW*out)
    def ToString(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        out = SOUI.SOUI_FACTORY.CreateStringW()
        this.lpVtbl.ToString(this, <IStringW*><DWORD_PTR>out.ptr())
        return out.c_str()

    # LPVOID GetPrivPtr(const IXmlNode* this)
    def GetPrivPtr(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPrivPtr(this)

    # BOOL Empty(const IXmlNode* this)
    def Empty(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Empty(this)

    # const wchar_t* Name(const IXmlNode* this)
    def Name(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Name(this)

    # const wchar_t* Value(const IXmlNode* this)
    def Value(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Value(this)

    # const wchar_t* Text(const IXmlNode* this)
    def Text(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Text(this)

    # BOOL set_userdata(IXmlNode* this, int data)
    def set_userdata(self, data):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.set_userdata(this, data)

    # int get_userdata(const IXmlNode* this)
    def get_userdata(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        return this.lpVtbl.get_userdata(this)

    # IXmlAttr* Attribute(const IXmlNode* this, const wchar_t* name,BOOL bCaseSensitive)
    def Attribute(self, name, bCaseSensitive=True):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlAttr* obj = this.lpVtbl.Attribute(this, name, <BOOL>bCaseSensitive)
        if obj != NULL:
            return SXmlAttr(<DWORD_PTR>obj)

    # IXmlAttr* FirstAttribute(const IXmlNode* this)
    def FirstAttribute(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlAttr* obj = this.lpVtbl.FirstAttribute(this)
        if obj != NULL:
            return SXmlAttr(<DWORD_PTR>obj)

    # IXmlAttr* LastAttribute(const IXmlNode* this)
    def LastAttribute(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlAttr* obj = this.lpVtbl.LastAttribute(this)
        if obj != NULL:
            return SXmlAttr(<DWORD_PTR>obj)

    # IXmlNode* Child(const IXmlNode* this, const wchar_t* name,BOOL bCaseSensitive)
    def Child(self, name, bCaseSensitive=True):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.Child(this, name, <BOOL>bCaseSensitive)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* FirstChild(const IXmlNode* this)
    def FirstChild(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.FirstChild(this)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* LastChild(const IXmlNode* this)
    def LastChild(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.LastChild(this)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* NextSibling(const IXmlNode* this)
    def NextSibling(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.NextSibling(this)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* PrevSibling(const IXmlNode* this)
    def PrevSibling(self):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.PrevSibling(this)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* NextSibling2(const IXmlNode* this, const wchar_t* name,BOOL bCaseSensitive)
    def NextSibling2(self, name, bCaseSensitive=True):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.NextSibling2(this, name, <BOOL>bCaseSensitive)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

    # IXmlNode* PrevSibling2(const IXmlNode* this, const wchar_t* name,BOOL bCaseSensitive)
    def PrevSibling2(self, name, bCaseSensitive=True):
        cdef IXmlNode* this = <IXmlNode*><DWORD_PTR>self._thisptr
        cdef IXmlNode* obj = this.lpVtbl.PrevSibling2(this, name, <BOOL>bCaseSensitive)
        if obj != NULL:
            return SXmlNode(<DWORD_PTR>obj)

cdef class SXmlAttr(SObjRef):
    # LPVOID GetPrivPtr(const IXmlAttr* this)
    def GetPrivPtr(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPrivPtr(this)

    # BOOL Empty(const IXmlAttr* this)
    def Empty(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Empty(this)

    # const wchar_t* Name(const IXmlAttr* this)
    def Name(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Name(this)

    # const wchar_t* Value(const IXmlAttr* this)
    def Value(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Value(this)

    # BOOL set_userdata(IXmlAttr* this, int data)
    def set_userdata(self, data):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.set_userdata(this, data)

    # int get_userdata(const IXmlAttr* this)
    def get_userdata(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        return this.lpVtbl.get_userdata(this)

    # IXmlAttr* Next(IXmlAttr* this)
    def Next(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        cdef IXmlAttr* obj = this.lpVtbl.Next(this)
        if obj != NULL:
            return SXmlAttr(<DWORD_PTR>obj)

    # IXmlAttr* Prev(IXmlAttr* this)
    def Prev(self):
        cdef IXmlAttr* this = <IXmlAttr*><DWORD_PTR>self._thisptr
        cdef IXmlAttr* obj = this.lpVtbl.Prev(this)
        if obj != NULL:
            return SXmlAttr(<DWORD_PTR>obj)

cdef class SStringW(SObjRef):
    # int GetLength(const IStringW* this)
    def GetLength(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetLength(this)

    # BOOL IsEmpty(const IStringW* this)
    def IsEmpty(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsEmpty(this)

    # void Empty(IStringW* this)
    def Empty(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        this.lpVtbl.Empty(this)

    # wchar_t GetAt(const IStringW* this, int nIndex)
    def GetAt(self, nIndex):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetAt(this, nIndex)

    # void SetAt(IStringW* this, int nIndex, wchar_t ch)
    def SetAt(self, nIndex, ch):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAt(this, nIndex, <wchar_t>ch)

    # const wchar_t* c_str(const IStringW* this)
    def c_str(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.c_str(this)

    # int Compare(const IStringW* this, const wchar_t* psz)
    def Compare(self, psz):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Compare(this, psz)

    # int CompareNoCase(const IStringW* this, const wchar_t* psz)
    def CompareNoCase(self, psz):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.CompareNoCase(this, psz)

    # void TrimBlank(IStringW* this)
    def TrimBlank(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        this.lpVtbl.TrimBlank(this)

    # int InsertChar(IStringW* this, int nIndex, wchar_t ch)
    def InsertChar(self, nIndex, ch):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertChar(this, nIndex, <wchar_t>ch)

    # int Insert(IStringW* this, int nIndex, const wchar_t* psz)
    def Insert(self, nIndex, psz):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Insert(this, nIndex, psz)

    # int Delete(IStringW* this, int nIndex, int nCount)
    def Delete(self, nIndex, nCount):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Delete(this, nIndex, nCount)

    # int ReplaceChar(IStringW* this, wchar_t chOld, wchar_t chNew)
    def ReplaceChar(self, chOld, chNew):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ReplaceChar(this, <wchar_t>chOld, <wchar_t>chNew)

    # int Replace(IStringW* this, const wchar_t* pszOld, const wchar_t* pszNew)
    def Replace(self, pszOld, pszNew):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Replace(this, pszOld, pszNew)

    # int Remove(IStringW* this, wchar_t chRemove)
    def Remove(self, chRemove):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Remove(this, <wchar_t>chRemove)

    # int FindChar(const IStringW* this, wchar_t ch, int nStart)
    def FindChar(self, ch, nStart):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.FindChar(this, <wchar_t>ch, nStart)

    # int ReverseFind(const IStringW* this, wchar_t ch)
    def ReverseFind(self, ch):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ReverseFind(this, <wchar_t>ch)

    # int Find(const IStringW* this, const wchar_t* pszSub, int nStart)
    def Find(self, pszSub, nStart):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Find(this, pszSub, nStart)

    # wchar_t* GetBuffer(IStringW* this, int nMinBufLength)
    def GetBuffer(self, nMinBufLength):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetBuffer(this, nMinBufLength)

    # void  ReleaseBuffer(IStringW* this, int nNewLength)
    def ReleaseBuffer(self, nNewLength):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ReleaseBuffer(this, nNewLength)

    # wchar_t*  GetBufferSetLength(IStringW* this, int nNewLength)
    def GetBufferSetLength(self, nNewLength):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetBufferSetLength(this, nNewLength)

    # void  SetLength(IStringW* this, int nLength)
    def SetLength(self, nLength):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetLength(this, nLength)

    # void  Copy(IStringW* this, const IStringW* src)
    def Copy(self, src):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Copy(this, <IStringW*><DWORD_PTR>src.ptr())

    # void  Assign(IStringW* this, LPCWSTR src)
    def Assign(self, src):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Assign(this, src)

    # void  Assign2(IStringW* this, LPCWSTR src,int nLen)
    def Assign2(self, src, nLen):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Assign2(this, src, nLen)

    # LPVOID GetPrivData(const IStringW* this)
    def GetPrivData(self):
        cdef IStringW* this = <IStringW*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPrivData(this)

cdef class SRenderObj(SObjRef):
    # IRenderFactory* GetRenderFactory(const IRenderObj* this)
    def GetRenderFactory(self):
        cdef IRenderObj* this = <IRenderObj*><DWORD_PTR>self._thisptr
        cdef IRenderFactory* obj = this.lpVtbl.GetRenderFactory(this)
        if obj != NULL:
            return SRenderFactory(<DWORD_PTR>obj)

    # OBJTYPE ObjectType(const IRenderObj* this)
    def ObjectType(self):
        cdef IRenderObj* this = <IRenderObj*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ObjectType(this)

cdef class SFontS(SRenderObj):
    # const LOGFONT* LogFont(const IFontS* this)
    def LogFont(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LogFont(this)

    # LPCTSTR FamilyName(const IFontS* this)
    def FamilyName(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.FamilyName(this)

    # int TextSize(const IFontS* this)
    def TextSize(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.TextSize(this)

    # BOOL IsBold(const IFontS* this)
    def IsBold(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsBold(this)

    # BOOL IsUnderline(const IFontS* this)
    def IsUnderline(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsUnderline(this)

    # BOOL IsItalic(const IFontS* this)
    def IsItalic(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsItalic(this)

    # BOOL IsStrikeOut(const IFontS* this)
    def IsStrikeOut(self):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsStrikeOut(this)

    # BOOL UpdateFont(IFontS* this, const LOGFONT*pLogFont)
    def UpdateFont(self, pLogFont):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UpdateFont(this, <const LOGFONT*><DWORD_PTR>pLogFont)

    # void SetProp(IFontS* this, IXmlNode* pXmlNode)
    def SetProp(self, pXmlNode):
        cdef IFontS* this = <IFontS*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetProp(this, <IXmlNode*><DWORD_PTR>pXmlNode.ptr())

cdef class SBitmapS(SRenderObj):
    # HRESULT Init(IBitmapS* this, int nWid, int nHei, const LPVOID pBits)
    def Init(self, nWid, nHei, pBits):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Init(this, nWid, nHei, <const LPVOID>pBits)

    # HRESULT Init2(IBitmapS* this, IImgFrame* pImgFrame)
    def Init2(self, pImgFrame):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Init2(this, <IImgFrame*><DWORD_PTR>pImgFrame.ptr())

    # HRESULT LoadFromFile(IBitmapS* this, LPCTSTR pszFileName)
    def LoadFromFile(self, pszFileName):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadFromFile(this, pszFileName)

    # HRESULT LoadFromMemory(IBitmapS* this, LPBYTE pBuf, size_t szLen)
    def LoadFromBytes(self, img_bytes):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadFromMemory(this, <LPBYTE>img_bytes, len(img_bytes))

    # HRESULT LoadFromMemory(IBitmapS* this, LPBYTE pBuf, size_t szLen)
    def LoadFromMemory(self, buff, length):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadFromMemory(this, <LPBYTE>buff, length)

    # UINT Width(const IBitmapS* this)
    def Width(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Width(this)

    # UINT Height(const IBitmapS* this)
    def Height(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Height(this)

    # SIZE Size(const IBitmapS* this)
    def Size(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        cdef SIZE _sz = this.lpVtbl.Size(this)
        return {'cx': _sz.cx, 'cy': _sz.cy}

    # LPVOID LockPixelBits(IBitmapS* this)
    def LockPixelBits(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.LockPixelBits(this)

    # void UnlockPixelBits(IBitmapS* this, LPVOID pBuf)
    def UnlockPixelBits(self, pBuf):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        this.lpVtbl.UnlockPixelBits(this, <LPVOID><DWORD_PTR>pBuf)

    # const LPVOID GetPixelBits(const IBitmapS* this)
    def GetPixelBits(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetPixelBits(this)

    # HRESULT Clone(const IBitmapS* this, IBitmapS**ppClone)
    def Clone(self):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        cdef IBitmapS* _ppClone
        if this.lpVtbl.Clone(this, &_ppClone) == 0:
            return SBitmapS(<DWORD_PTR>_ppClone)

    # HRESULT Scale(const IBitmapS* this, IBitmapS**pOutput, int nScale, FilterLevel filterLevel)
    def Scale(self, nScale, filterLevel):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        cdef IBitmapS* _pOutput
        if this.lpVtbl.Scale(this, &_pOutput, nScale, <FilterLevel>filterLevel) == 0:
            return SBitmapS(<DWORD_PTR>_pOutput)

    # HRESULT Scale2(const IBitmapS* this, IBitmapS**pOutput, int nWid, int nHei, FilterLevel filterLevel)
    def Scale2(self, nWid, nHei, filterLevel):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        cdef IBitmapS* _pOutput
        if this.lpVtbl.Scale2(this, &_pOutput, nWid, nHei, <FilterLevel>filterLevel) == 0:
            return SBitmapS(<DWORD_PTR>_pOutput)

    # HRESULT Save(const IBitmapS* this, LPCWSTR pszFileName, const LPVOID pFormat)
    def Save(self, pszFileName, pFormat):
        cdef IBitmapS* this = <IBitmapS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Save(this, pszFileName, <const LPVOID>pFormat)

cdef class SRegionS(SRenderObj):
    # void CombineRect(IRegionS* this, LPCRECT lprect, int nCombineMode)
    def CombineRect(self, lprect, nCombineMode):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef RECT _lprect = RECT(lprect['left'], lprect['top'], lprect['right'], lprect['bottom'])
        this.lpVtbl.CombineRect(this, &_lprect, nCombineMode)

    # void CombineRgn(IRegionS* this, const IRegionS*pRgnSrc, int nCombineMode)
    def CombineRgn(self, pRgnSrc, nCombineMode):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        this.lpVtbl.CombineRgn(this, <IRegionS*><DWORD_PTR>pRgnSrc.ptr(), nCombineMode)

    # void CombineRoundRect(IRegionS* this, LPCRECT lprect, POINT ptConner, int nCombineMode)
    def CombineRoundRect(self, lprect, ptConner, nCombineMode):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef RECT _lprect = RECT(lprect['left'], lprect['top'], lprect['right'], lprect['bottom'])
        cdef POINT _ptConner = POINT(ptConner['x'], ptConner['y'])
        this.lpVtbl.CombineRoundRect(this, &_lprect, _ptConner, nCombineMode)

    # void CombineEllipse(IRegionS* this, LPCRECT lprect, int nCombineMode)
    def CombineEllipse(self, lprect, nCombineMode):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef RECT _lprect = RECT(lprect['left'], lprect['top'], lprect['right'], lprect['bottom'])
        this.lpVtbl.CombineEllipse(this, &_lprect, nCombineMode)

    # void CombinePolygon(IRegionS* this, const POINT*pts, int count, int nPolygonMode, int nCombineMode)
    def CombinePolygon(self, pts, nPolygonMode, nCombineMode):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        count = len(pts)
        cdef POINT *_pts = <POINT*>malloc(count * sizeof(POINT))
        for idx, pt in enumerate(pts):
            _pts[idx].x, _pts[idx].y = pt['x'], pt['y']
        this.lpVtbl.CombinePolygon(this, _pts, count, nPolygonMode, nCombineMode)
        free(_pts)

    # BOOL PtInRegion(const IRegionS* this, POINT pt)
    def PtInRegion(self, pt):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        return <BOOL>this.lpVtbl.PtInRegion(this, _pt)

    # BOOL RectInRegion(const IRegionS* this, LPCRECT lprect)
    def RectInRegion(self, lprect):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef RECT _lprect = RECT(lprect['left'], lprect['top'], lprect['right'], lprect['bottom'])
        return <BOOL>this.lpVtbl.RectInRegion(this, &_lprect)

    # void GetRgnBox(const IRegionS* this, LPRECT lprect)
    def GetRgnBox(self):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef RECT _lprect
        this.lpVtbl.GetRgnBox(this, &_lprect)
        return {'left': _lprect.left, 'top': _lprect.top, 'right': _lprect.right, 'bottom': _lprect.bottom}

    # BOOL IsEmpty(const IRegionS* this)
    def IsEmpty(self):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsEmpty(this)

    # void Offset(IRegionS* this, POINT pt)
    def Offset(self, pt):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        this.lpVtbl.Offset(this, _pt)

    # void Clear(IRegionS* this)
    def Clear(self):
        cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
        this.lpVtbl.Clear(this)

    # BOOL IsEqual(const IRegionS* this, const IRegionS*testRgn)  # Method not available in SOUI5
    # def IsEqual(self, testRgn):
    #     cdef IRegionS* this = <IRegionS*><DWORD_PTR>self._thisptr
    #     return <BOOL>this.lpVtbl.IsEqual(this, <IRegionS*><DWORD_PTR>testRgn.ptr())

cdef class SPathS(SRenderObj):
    # FillType getFillType(const IPathS* this)
    def getFillType(self):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.getFillType(this)

    # void setFillType(IPathS* this, FillType ft)
    def setFillType(self, ft):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.setFillType(this, <FillType>ft)

    # BOOL isInverseFillType(const IPathS* this)  # Method not available in SOUI5
    # def isInverseFillType(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return <BOOL>this.lpVtbl.isInverseFillType(this)

    # void toggleInverseFillType(IPathS* this)  # Method not available in SOUI5
    # def toggleInverseFillType(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.toggleInverseFillType(this)

    # Convexity getConvexity(const IPathS* this)  # Method not available in SOUI5
    # def getConvexity(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return this.lpVtbl.getConvexity(this)

    # void setConvexity(IPathS* this, Convexity c)  # Method not available in SOUI5
    # def setConvexity(self, c):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.setConvexity(this, <Convexity>c)

    # BOOL isConvex(const IPathS* this)  # Method not available in SOUI5
    # def isConvex(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return <BOOL>this.lpVtbl.isConvex(this)

    # BOOL isOval(const IPathS* this, RECT* rect)  # Method not available in SOUI5
    # def isOval(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef RECT _rect
    #     if this.lpVtbl.isOval(this, &_rect):
    #         return {'left': _rect.left, 'top': _rect.top, 'right': _rect.right, 'bottom': _rect.bottom}

    # void reset(IPathS* this)
    def reset(self):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.reset(this)

    # void rewind(IPathS* this)  # Method not available in SOUI5
    # def rewind(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.rewind(this)

    # BOOL isEmpty(const IPathS* this)
    def isEmpty(self):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.isEmpty(this)

    # BOOL isFinite(const IPathS* this)  # Method not available in SOUI5
    # def isFinite(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return <BOOL>this.lpVtbl.isFinite(this)

    # BOOL isLine(const IPathS* this, POINT line[2])  # Method not available in SOUI5
    # def isLine(self, line):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef POINT _line[2]
    #     _line[0] = POINT(line[0]['x'], line[0]['y'])
    #     _line[1] = POINT(line[1]['x'], line[1]['y'])
    #     return <BOOL>this.lpVtbl.isLine(this, _line)

    # BOOL isRect(const IPathS* this, RECT* rect)  # Method not available in SOUI5
    # def isRect(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef RECT _rect
    #     if this.lpVtbl.isRect(this, &_rect):
    #         return {'left': _rect.left, 'top': _rect.top, 'right': _rect.right, 'bottom': _rect.bottom}

    # int countPoints(const IPathS* this)  # Method not available in SOUI5
    # def countPoints(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return this.lpVtbl.countPoints(this)

    # fPoint getPoint(const IPathS* this, int index)  # Method not available in SOUI5
    # def getPoint(self, index):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef fPoint _fpt = this.lpVtbl.getPoint(this, index)
    #     return {'fX': _fpt.fX, 'fY': _fpt.fY}

    # int getPoints(const IPathS* this, fPoint points[], int max)  # Method not available in SOUI5
    # def getPoints(self, max):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef fPoint *_points = <fPoint*>malloc(max * sizeof(fPoint))
    #     iret = this.lpVtbl.getPoints(this, _points, max)
    #     result = []
    #     for idx in range(iret):
    #         result.append({'fX': _points[idx].fX, 'fY': _points[idx].fY})
    #     free(_points)
    #     return result

    # int countVerbs(const IPathS* this)  # Method not available in SOUI5
    # def countVerbs(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     return this.lpVtbl.countVerbs(this)

    # int getVerbs(const IPathS* this, BYTE verbs[], int max)  # Method not available in SOUI5
    # def getVerbs(self, max):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef BYTE* _verbs = <BYTE*>malloc(max * sizeof(BYTE))
    #     iret = this.lpVtbl.getVerbs(this, _verbs, max)
    #     result = []
    #     for idx in range(iret):
    #         result.append(_verbs[idx])
    #     free(_verbs)
    #     return result

    # void getBounds(const IPathS* this, LPRECT prc)
    def getBounds(self):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef RECT _rc
        this.lpVtbl.getBounds(this, &_rc)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

    # void moveTo(IPathS* this, float x, float y)
    def moveTo(self, x, y):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.moveTo(this, x, y)

    # void rMoveTo(IPathS* this, float dx, float dy)
    def rMoveTo(self, dx, dy):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.rMoveTo(this, dx, dy)

    # void lineTo(IPathS* this, float x, float y)
    def lineTo(self, x, y):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.lineTo(this, x, y)

    # void rLineTo(IPathS* this, float dx, float dy)
    def rLineTo(self, dx, dy):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.rLineTo(this, dx, dy)

    # void quadTo(IPathS* this, float x1, float y1, float x2, float y2)
    def quadTo(self, x1, y1, x2, y2):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.quadTo(this, x1, y1, x2, y2)

    # void rQuadTo(IPathS* this, float dx1, float dy1, float dx2, float dy2)
    def rQuadTo(self, dx1, dy1, dx2, dy2):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.rQuadTo(this, dx1, dy1, dx2, dy2)

    # void conicTo(IPathS* this, float x1, float y1, float x2, float y2, float w)
    def conicTo(self, x1, y1, x2, y2, w):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.conicTo(this, x1, y1, x2, y2, w)

    # void rConicTo(IPathS* this, float dx1, float dy1, float dx2, float dy2, float w)
    def rConicTo(self, dx1, dy1, dx2, dy2, w):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.rConicTo(this, dx1, dy1, dx2, dy2, w)

    # void cubicTo(IPathS* this, float x1, float y1, float x2, float y2, float x3, float y3)
    def cubicTo(self, x1, y1, x2, y2, x3, y3):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.cubicTo(this, x1, y1, x2, y2, x3, y3)

    # void rCubicTo(IPathS* this, float x1, float y1, float x2, float y2, float x3, float y3)
    def rCubicTo(self, x1, y1, x2, y2, x3, y3):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.rCubicTo(this, x1, y1, x2, y2, x3, y3)

    # void arcTo(IPathS* this, const RECT*oval, float startAngle, float sweepAngle, BOOL forceMoveTo)  # Method not available in SOUI5
    # def arcTo(self, oval, startAngle, sweepAngle, forceMoveTo):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef RECT _oval = RECT(oval['left'], oval['top'], oval['right'], oval['bottom'])
    #     this.lpVtbl.arcTo(this, &_oval, startAngle, sweepAngle, <BOOL>forceMoveTo)

    # void arcTo2(IPathS* this, float x1, float y1, float x2, float y2, float radius)  # Method not available in SOUI5
    # def arcTo2(self, x1, y1, x2, y2, radius):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.arcTo2(this, x1, y1, x2, y2, radius)

    # void close(IPathS* this)
    def close(self):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.close(this)

    # BOOL isRect2(const IPathS* this, BOOL* isClosed, Direction* direction)  # Method not available in SOUI5
    # def isRect2(self, isClosed, direction):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef BOOL _isClosed
    #     cdef Direction _direction
    #     if this.lpVtbl.isRect2(this, &_isClosed, &_direction):
    #         return _isClosed, _direction

    # void addRect(IPathS* this, const RECT*rect, Direction dir)
    def addRect(self, rect, dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef RECT _rect = RECT(rect['left'], rect['top'], rect['right'], rect['bottom'])
        this.lpVtbl.addRect(this, &_rect, <Direction>dir)

    # void addRect2(IPathS* this, float left, float top, float right, float bottom, Direction dir)
    def addRect2(self, left, top, right, bottom, dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.addRect2(this, left, top, right, bottom, <Direction>dir)

    # void addOval(IPathS* this, const RECT*oval, Direction dir)
    def addOval(self, oval, dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef RECT _oval = RECT(oval['left'], oval['top'], oval['right'], oval['bottom'])
        this.lpVtbl.addOval(this, &_oval, <Direction>dir)

    # void addCircle(IPathS* this, float x, float y, float radius, Direction dir)
    def addCircle(self, x, y, radius, dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.addCircle(this, x, y, radius, <Direction>dir)

    # void addArc(IPathS* this, const RECT*oval, float startAngle, float sweepAngle)
    def addArc(self, oval, startAngle, sweepAngle):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef RECT _oval = RECT(oval['left'], oval['top'], oval['right'], oval['bottom'])
        this.lpVtbl.addArc(this, &_oval, startAngle, sweepAngle)

    # void addRoundRect(IPathS* this, const RECT*rect, float rx, float ry, Direction dir)
    def addRoundRect(self, rect, rx, ry, dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef RECT _rect = RECT(rect['left'], rect['top'], rect['right'], rect['bottom'])
        this.lpVtbl.addRoundRect(this, &_rect, rx, ry, <Direction>dir)

    # void addRoundRect2(IPathS* this, float left, float top, float right, float bottom, float rx, float ry, Direction dir) 
    def addRoundRect2(self, left, top, right, bottom, rx,ry , dir):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.addRoundRect2(this, left, top, right,bottom, rx,ry , <Direction>dir)

    # void addPoly(IPathS* this, const POINT pts[], int count, BOOL close)
    def addPoly(self, pts, close):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        cdef int count = len(pts)
        cdef POINT *_pts = <POINT*>malloc(count * sizeof(POINT))
        for idx, pt in enumerate(pts):
            _pts[idx].x, _pts[idx].y = pt['x'], pt['y']
        this.lpVtbl.addPoly(this, _pts, count, <BOOL>close)
        free(_pts)

    # void addPath(IPathS* this, const IPathS*src, float dx, float dy, AddPathMode mode)  # Method not available in SOUI5
    # def addPath(self, src, dx, dy, mode):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.addPath(this, <IPathS*><DWORD_PTR>src.ptr(), dx, dy, <AddPathMode>mode)

    # void reverseAddPath(IPathS* this, const IPathS*src)  # Method not available in SOUI5
    # def reverseAddPath(self, src):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.reverseAddPath(this, <IPathS*><DWORD_PTR>src.ptr())

    # void offset(IPathS* this, float dx, float dy)  # Method not available in SOUI5
    # def offset(self, dx, dy):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.offset(this, dx, dy)

    # void transform(IPathS* this, const IxForm*matrix)  # Method not available in SOUI5
    # def transform(self, matrix):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef IxForm _matrix
    #     for idx in range(9):
    #         _matrix.fMat[idx] = matrix[idx]
    #     this.lpVtbl.transform(this, &_matrix)

    # BOOL getLastPt(const IPathS* this, POINT* lastPt)  # Method not available in SOUI5
    # def getLastPt(self):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef POINT _lastPt
    #     if this.lpVtbl.getLastPt(this, &_lastPt):
    #         return {'x': _lastPt.x, 'y': _lastPt.y}

    # void setLastPt(IPathS* this, float x, float y)  # Method not available in SOUI5
    # def setLastPt(self, x, y):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     this.lpVtbl.setLastPt(this, x, y)

    # void addString(IPathS* this, LPCTSTR pszText, int nLen, float x, float y, const IFontS*pFont)
    def addString(self, pszText, nLen, x, y, pFont):
        cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
        this.lpVtbl.addString(this, pszText, nLen, x, y, <IFontS*><DWORD_PTR>pFont.ptr())

    # IPathInfo* approximate(IPathS* this, float acceptableError)
    # def approximate(self, acceptableError):
    #     cdef IPathS* this = <IPathS*><DWORD_PTR>self._thisptr
    #     cdef IPathInfo* obj = this.lpVtbl.approximate(this, acceptableError)
    #     if obj != NULL:
    #         return SPathInfo(<DWORD_PTR>obj)

# cdef class SPathInfo(SObjRef):
#     # int pointNumber(const IPathInfo* this)
#     def pointNumber(self):
#         cdef IPathInfo* this = <IPathInfo*><DWORD_PTR>self._thisptr
#         return this.lpVtbl.pointNumber(this)
#
#     # const float* data(const IPathInfo* this)
#     def data(self):
#         cdef IPathInfo* this = <IPathInfo*><DWORD_PTR>self._thisptr
#         return <DWORD_PTR>this.lpVtbl.data(this)

cdef class SPenS(SRenderObj):
    # int GetWidth(const IPenS* this)
    def GetWidth(self):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetWidth(this)

    # void SetWidth(IPenS* this, int nWid)
    def SetWidth(self, nWid):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetWidth(this, nWid)

    # int GetStyle(const IPenS* this)
    def GetStyle(self):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetStyle(this)

    # void SetStyle(IPenS* this, int nStyle)
    def SetStyle(self, nStyle):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetStyle(this, nStyle)

    # COLORREF GetColor(const IPenS* this)
    def GetColor(self):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetColor(this)

    # void SetColor(IPenS* this, COLORREF cr)
    def SetColor(self, cr):
        cdef IPenS* this = <IPenS*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetColor(this, <COLORREF>cr)

cdef class SBrushS(SRenderObj):
    pass

cdef class SPathEffect(SObjRef):
    # void* GetRealPathEffect(IPathEffect* this)
    def GetRealPathEffect(self):
        cdef IPathEffect* this = <IPathEffect*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetRealPathEffect(this)

cdef class SImgX(SObjRef):
    # int LoadFromMemory(IImgX* this, void*pBuf, size_t bufLen)
    def LoadFromMemory(self, pBuf):
        cdef IImgX* this = <IImgX*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadFromMemory(this, <void*>pBuf, len(pBuf))

    # int LoadFromFileW(IImgX* this, LPCWSTR pszFileName)
    def LoadFromFile(self, pszFileName):
        cdef IImgX* this = <IImgX*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadFromFileW(this, pszFileName)

    # UINT GetFrameCount(IImgX* this)
    def GetFrameCount(self):
        cdef IImgX* this = <IImgX*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetFrameCount(this)

    # IImgFrame* GetFrame(IImgX* this, UINT iFrame)
    def GetFrame(self, iFrame):
        cdef IImgX* this = <IImgX*><DWORD_PTR>self._thisptr
        cdef IImgFrame* obj = this.lpVtbl.GetFrame(this, iFrame)
        if obj != NULL:
            return SImgFrame(<DWORD_PTR>obj)

cdef class SSkinObj(SObject):
    # void DrawByState2(const ISkinObj* this, IRenderTarget* pRT, LPCRECT rcDraw, DWORD dwState, BYTE byAlpha)
    def DrawByState2(self, pRT, rcDraw, dwState, byAlpha):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef RECT _rcDraw = RECT(rcDraw['left'], rcDraw['top'], rcDraw['right'], rcDraw['bottom'])
        this.lpVtbl.DrawByState2(this, <IRenderTarget*><DWORD_PTR>pRT.ptr(), &_rcDraw, dwState, <BYTE>byAlpha)

    # void DrawByState(const ISkinObj* this, IRenderTarget* pRT, LPCRECT rcDraw, DWORD dwState)
    def DrawByState(self, pRT, rcDraw, dwState):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef RECT _rcDraw = RECT(rcDraw['left'], rcDraw['top'], rcDraw['right'], rcDraw['bottom'])
        this.lpVtbl.DrawByState(this, <IRenderTarget*><DWORD_PTR>pRT.ptr(), &_rcDraw, dwState)

    # void DrawByIndex2(const ISkinObj* this, IRenderTarget* pRT, LPCRECT rcDraw, int iState, BYTE byAlpha)
    def DrawByIndex2(self, pRT, rcDraw, iState, byAlpha):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef RECT _rcDraw = RECT(rcDraw['left'], rcDraw['top'], rcDraw['right'], rcDraw['bottom'])
        this.lpVtbl.DrawByIndex2(this, <IRenderTarget*><DWORD_PTR>pRT.ptr(), &_rcDraw, iState, <BYTE>byAlpha)

    # void DrawByIndex(const ISkinObj* this, IRenderTarget* pRT, LPCRECT rcDraw, int iState)
    def DrawByIndex(self, pRT, rcDraw, iState):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef RECT _rcDraw = RECT(rcDraw['left'], rcDraw['top'], rcDraw['right'], rcDraw['bottom'])
        this.lpVtbl.DrawByIndex(this, <IRenderTarget*><DWORD_PTR>pRT.ptr(), &_rcDraw, iState)

    # SIZE GetSkinSize(const ISkinObj* this)
    def GetSkinSize(self):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef SIZE _sz = this.lpVtbl.GetSkinSize(this)
        return {'cx': _sz.cx, 'cy': _sz.cy}

    # int GetStates(const ISkinObj* this)
    def GetStates(self):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetStates(this)

    # BYTE GetAlpha(const ISkinObj* this)
    def GetAlpha(self):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetAlpha(this)

    # void SetAlpha(ISkinObj* this, BYTE byAlpha)
    def SetAlpha(self, byAlpha):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAlpha(this, <BYTE>byAlpha)

    # void OnColorize(ISkinObj* this, COLORREF cr)
    def OnColorize(self, cr):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnColorize(this, <COLORREF>cr)

    # int GetScale(const ISkinObj* this)
    def GetScale(self):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScale(this)

    # ISkinObj* Scale(ISkinObj* this, int nScale)
    def Scale(self, nScale):
        cdef ISkinObj* this = <ISkinObj*><DWORD_PTR>self._thisptr
        cdef ISkinObj* obj = this.lpVtbl.Scale(this, nScale)
        if obj != NULL:
            return SSkinObj(<DWORD_PTR>obj)

cdef class SWindow(SObject):
    # HRESULT QueryInterface(IWindow* this, REFGUID id, IObjRef **ppRet)
    def QueryInterface(self, IID):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* ppRet = NULL
        cdef GUID _IID
        #_IID.Data1, _IID.Data2, _IID.Data3, _IID.Data4 = (0xE584B16A, 0x6BDB, 0x4afb, [0x8B,0xCC,0x3A,0x1A,0xBA,0xCD,0x2F,0xE2])
        if hasattr(IID, 'IID'):
            _IID.Data1, _IID.Data2, _IID.Data3, _IID.Data4[:] = IID.IID
            nRet = this.lpVtbl.QueryInterface(this, &_IID, <IObjRef**>&ppRet)
            r_obj = IID(<DWORD_PTR>ppRet)
            r_obj.Release()
            return r_obj
        else:
            _IID.Data1, _IID.Data2, _IID.Data3, _IID.Data4[:] = IID
            nRet = this.lpVtbl.QueryInterface(this, &_IID, <IObjRef**>&ppRet)
            return <DWORD_PTR>ppRet

    # ISwndContainer* GetContainer(IWindow* this)
    def GetContainer(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef ISwndContainer* obj = this.lpVtbl.GetContainer(this)
        if obj!= NULL:
            return SSwndContainer(<DWORD_PTR>obj)

    # void SetContainer(IWindow* this, ISwndContainer * pContainer)
    def SetContainer(self, pContainer):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetContainer(this, <ISwndContainer*><DWORD_PTR>pContainer.ptr())

    # SWND GetSwnd(IWindow* this)
    def GetSwnd(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSwnd(this)

    # ILayout* GetLayout(IWindow* this)
    def GetLayout(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetLayout(this)

    # ILayoutParam* GetLayoutParam(IWindow* this)
    def GetLayoutParam(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetLayoutParam(this)

    # BOOL SetLayoutParam(IWindow* this, ILayoutParam * pLayoutParam)
    def SetLayoutParam(self, pLayoutParam):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetLayoutParam(this, <ILayoutParam*>pLayoutParam)

    # BOOL IsFloat(IWindow* this)
    def IsFloat(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsFloat(this)

    # BOOL IsDisplay(IWindow* this)
    def IsDisplay(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsDisplay(this)

    # BOOL IsMsgTransparent(IWindow* this)
    def IsMsgTransparent(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsMsgTransparent(this)

    # BOOL IsClipClient(IWindow* this)
    def IsClipClient(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsClipClient(this)

    # void SetToolTipText(IWindow* this, LPCTSTR pszText)
    def SetToolTipText(self, pszText):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetToolTipText(this, pszText)

    # BOOL IsChecked(IWindow* this)
    def IsChecked(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsChecked(this)

    # void SetCheck(IWindow* this, BOOL bCheck)
    def SetCheck(self, bCheck):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetCheck(this, <BOOL>bCheck)

    # BOOL IsDisabled(IWindow* this, BOOL bCheckParent)
    def IsDisabled(self, bCheckParent=False):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsDisabled(this, <BOOL>bCheckParent)

    # void EnableWindow(IWindow* this, BOOL bEnable, BOOL bUpdate)
    def EnableWindow(self, bEnable, bUpdate=True):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.EnableWindow(this, <BOOL>bEnable, <BOOL>bUpdate)

    # BOOL IsVisible(IWindow* this, BOOL bCheckParent)
    def IsVisible(self, bCheckParent=False):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsVisible(this, <BOOL>bCheckParent)

    # void SetVisible(IWindow* this, BOOL bVisible, BOOL bUpdate)
    def SetVisible(self, bVisible, bUpdate=True):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetVisible(this, <BOOL>bVisible, <BOOL>bUpdate)

    # ULONG_PTR GetUserData(IWindow* this)
    def GetUserData(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetUserData(this)

    # ULONG_PTR SetUserData(IWindow* this, ULONG_PTR uData)
    def SetUserData(self, uData):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetUserData(this, uData)

    # void DoColorize(IWindow* this, COLORREF cr)
    def DoColorize(self, cr):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.DoColorize(this, <COLORREF>cr)

    # COLORREF GetColorizeColor(IWindow* this)
    def GetColorizeColor(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetColorizeColor(this)

    # LRESULT SSendMessage(IWindow* this, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL * pbMsgHandled)
    def SSendMessage(self, uMsg, wParam, lParam, pbMsgHandled):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef BOOL msgHandled
        return this.lpVtbl.SSendMessage(this, uMsg, wParam, lParam, &msgHandled)

    # void SDispatchMessage(IWindow* this, UINT uMsg, WPARAM wParam, LPARAM lParam)
    def SDispatchMessage(self, uMsg, wParam, lParam):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SDispatchMessage(this, uMsg, wParam, lParam)

    # BOOL IsFocusable(IWindow* this)
    def IsFocusable(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsFocusable(this)

    # BOOL IsFocused(IWindow* this)
    def IsFocused(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsFocused(this)

    # void SetFocus(IWindow* this)
    def SetFocus(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetFocus(this)

    # void KillFocus(IWindow* this)
    def KillFocus(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.KillFocus(this)

    # void Invalidate(IWindow* this)
    def Invalidate(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Invalidate(this)

    # void InvalidateRect(IWindow* this, LPCRECT lprect)
    def InvalidateRect(self, lprect):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef RECT _lprect
        _lprect.left, _lprect.top, _lprect.right, _lprect.bottom = lprect['left'], lprect['top'], lprect['right'], lprect['bottom']
        return this.lpVtbl.InvalidateRect(this, &_lprect)

    # void LockUpdate(IWindow* this)
    def LockUpdate(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LockUpdate(this)

    # void UnlockUpdate(IWindow* this)
    def UnlockUpdate(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.UnlockUpdate(this)

    # BOOL IsUpdateLocked(IWindow* this, BOOL bCheckParent)
    def IsUpdateLocked(self, bCheckParent=False):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsUpdateLocked(this, <BOOL>bCheckParent)

    # void Update(IWindow* this, BOOL bForce)
    def Update(self, bForce=False):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Update(this, <BOOL>bForce)

    # void SetWindowRgn(IWindow* this, IRegionS * pRgn, BOOL bRedraw)
    def SetWindowRgn(self, pRgn, bRedraw):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetWindowRgn(this, <IRegionS*>pRgn, <BOOL>bRedraw)

    # IRegionS* GetWindowRgn(IWindow* this)
    def GetWindowRgn(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IRegionS* obj = this.lpVtbl.GetWindowRgn(this)
        if obj != NULL:
            return SRegionS(<DWORD_PTR>obj)

    # void SetWindowPath(IWindow* this, IPathS * pPath, BOOL bRedraw)
    def SetWindowPath(self, pPath, bRedraw):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetWindowPath(this, <IPathS*>pPath, <BOOL>bRedraw)

    # IPathS* GetWindowPath(IWindow* this)
    def GetWindowPath(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IPathS* obj = this.lpVtbl.GetWindowPath(this)
        if obj!= NULL:
            return SPathS(<DWORD_PTR>obj)

    # void Move2(IWindow* this, int x, int y, int cx, int cy)
    def Move2(self, x, y, cx, cy):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Move2(this, x, y, cx, cy)

    # void Move(IWindow* this, LPCRECT prect)
    def Move(self, rect):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef RECT _rect = RECT(rect['left'], rect['top'], rect['right'], rect['bottom'])
        return this.lpVtbl.Move(this, &_rect)

    # void GetWindowRect(IWindow* this, LPRECT prect)
    def GetWindowRect(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef RECT _prect
        this.lpVtbl.GetWindowRect(this, &_prect)
        return {'left': _prect.left, 'top': _prect.top, 'right': _prect.right, 'bottom': _prect.bottom}

    # void GetClientRect(IWindow* this, LPRECT prect)
    def GetClientRect(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef RECT _prect
        this.lpVtbl.GetClientRect(this, &_prect)
        return {'left': _prect.left, 'top': _prect.top, 'right': _prect.right, 'bottom': _prect.bottom}

    # BOOL IsContainPoint(IWindow* this, POINT pt, BOOL bClientOnly)
    def IsContainPoint(self, pt, bClientOnly):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef POINT _pt
        _pt.x, _pt.y = pt
        return <BOOL>this.lpVtbl.IsContainPoint(this, _pt, <BOOL>bClientOnly)

    # SWND SwndFromPoint(IWindow* this, POINT * pt, BOOL bIncludeMsgTransparent)
    def SwndFromPoint(self, pt, bIncludeMsgTransparent):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef POINT _pt
        _pt.x, _pt.y = pt
        return this.lpVtbl.SwndFromPoint(this, &_pt, <BOOL>bIncludeMsgTransparent)

    # BOOL SetTimer(IWindow* this, char id, UINT uElapse)
    def SetTimer(self, id, uElapse):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetTimer(this, <char>id, uElapse)

    # void KillTimer(IWindow* this, char id)
    def KillTimer(self, id):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.KillTimer(this, <char>id)

    # SWND GetCapture(IWindow* this)
    def GetCapture(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCapture(this)

    # SWND SetCapture(IWindow* this)
    def SetCapture(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetCapture(this)

    # BOOL ReleaseCapture(IWindow* this)
    def ReleaseCapture(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ReleaseCapture(this)

    # void SetAnimation(IWindow* this, IAnimation * animation)
    def SetAnimation(self, animation):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetAnimation(this, <IAnimation*>animation)

    # void StartAnimation(IWindow* this, IAnimation * animation)
    def StartAnimation(self, animation):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.StartAnimation(this, <IAnimation*>animation)

    # IAnimation* GetAnimation(IWindow* this)
    def GetAnimation(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IAnimation* obj = this.lpVtbl.GetAnimation(this)
        if obj != NULL:
            return SAnimation(<DWORD_PTR>obj)

    # void ClearAnimation(IWindow* this)
    def ClearAnimation(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ClearAnimation(this)

    # void SetAlpha(IWindow* this, BYTE byAlpha)
    def SetAlpha(self, byAlpha):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetAlpha(this, <BYTE>byAlpha)

    # BYTE GetAlpha(IWindow* this)
    def GetAlpha(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetAlpha(this)

    # void SetMatrix(IWindow* this, const IMatrix *mtx)
    def SetMatrix(self, mtx):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetMatrix(this, <const IMatrix*><DWORD_PTR>mtx)

    # void GetMatrix(IWindow* this, IMatrix * mtx)
    def GetMatrix(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IMatrix _mtx
        this.lpVtbl.GetMatrix(this, &_mtx)
        return SMatrix(<DWORD_PTR>&_mtx)

    # int GetScale(IWindow* this)
    def GetScale(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScale(this)

    # void RequestRelayout(IWindow* this)
    def RequestRelayout(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.RequestRelayout(this)

    # void UpdateLayout(IWindow* this)
    def UpdateLayout(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.UpdateLayout(this)

    # void UpdateChildrenPosition(IWindow* this)
    def UpdateChildrenPosition(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.UpdateChildrenPosition(this)

    # BOOL IsLayoutDirty(IWindow* this)
    def IsLayoutDirty(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsLayoutDirty(this)

    # UINT OnGetDlgCode(IWindow* this)
    def OnGetDlgCode(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.OnGetDlgCode(this)

    # IWindow* GetIRoot(IWindow* this)
    def GetRoot(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIRoot(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # IWindow* GetIParent(IWindow* this)
    def GetParent(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIParent(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # IWindow* GetIWindow(IWindow* this, int uCode)
    def GetWindow(self, uCode):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIWindow(this, uCode)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # IWindow* GetIChild(IWindow* this, int iChild)
    def GetChild(self, iChild):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIChild(this, iChild)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # UINT GetChildrenCount(IWindow* this)
    def GetChildrenCount(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetChildrenCount(this)

    # BOOL IsDescendant(const IWindow* this, const IWindow *pTest)
    def IsDescendant(self, pTest):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsDescendant(this, <const IWindow*><DWORD_PTR>pTest.ptr())

    # void SetIOwner(IWindow* this, IWindow * pOwner)
    def SetOwner(self, pOwner):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetIOwner(this, <IWindow*><DWORD_PTR>pOwner.ptr())

    # IWindow* GetIOwner(IWindow* this)
    def GetOwner(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIOwner(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # void BringWindowToTop(IWindow* this)
    def BringWindowToTop(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.BringWindowToTop(this)

    # BOOL AdjustIZOrder(IWindow* this, IWindow * pInsertAfter)
    def AdjustZOrder(self, pInsertAfter):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AdjustIZOrder(this, <IWindow*><DWORD_PTR>pInsertAfter.ptr())

    # void InsertIChild(IWindow* this, IWindow * pNewChild, IWindow * pInsertAfter)
    def InsertChild(self, pNewChild, pInsertAfter):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertIChild(this, <IWindow*><DWORD_PTR>pNewChild, <IWindow*><DWORD_PTR>pInsertAfter)

    # BOOL RemoveIChild(IWindow* this, IWindow * pChild)
    def RemoveChild(self, pChild):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveIChild(this, <IWindow*><DWORD_PTR>pChild)

    # BOOL CreateChildrenFromXml(IWindow* this, LPCWSTR pszXml)
    def CreateChildrenFromXml(self, pszXml):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CreateChildrenFromXml(this, <LPCWSTR>pszXml)

    # IWindow* FindIChildByID(IWindow* this, int nId)
    def FindChildByID(self, nId):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByID(this, nId)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    def FindChildByID2(self, nId, classType):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByID(this, nId)
        cdef IWindow* ppRet = NULL
        cdef GUID _id
        cdef HRESULT hr
        if obj == NULL:
            return None
        if hasattr(classType, 'IID'):
            _id.Data1, _id.Data2, _id.Data3, _id.Data4[:] = classType.IID
            hr=obj.lpVtbl.QueryInterface(obj, &_id, <IObjRef**>&ppRet)
            #print(f"[FindChildByID2] QueryInterface GUID: {{{_id.Data1:08x}-{_id.Data2:04x}-{_id.Data3:04x}-{_id.Data4[0]:02x}{_id.Data4[1]:02x}-{_id.Data4[2]:02x}{_id.Data4[3]:02x}{_id.Data4[4]:02x}{_id.Data4[5]:02x}{_id.Data4[6]:02x}{_id.Data4[7]:02x}}},result: hr=0x{hr:08x}, pointer={<DWORD_PTR>ppRet:x}")
            # 检查 QueryInterface 是否成功 (S_OK = 0)
            if hr != 0 or ppRet == NULL:
                return None

            r_obj = classType(<DWORD_PTR>ppRet)
            r_obj.Release()
            return r_obj
        return classType(<DWORD_PTR>obj)

    # IWindow* FindIChildByName(IWindow* this, LPCWSTR pszName)
    def FindChildByName(self, pszName):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByName(this, pszName)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)
    
    def FindChildByName2(self, pszName, classType):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByName(this, pszName)
        cdef IWindow* ppRet = NULL
        cdef GUID _id
        cdef HRESULT hr
        if obj == NULL:
            return None
        if hasattr(classType, 'IID'):
            _id.Data1, _id.Data2, _id.Data3, _id.Data4[:] = classType.IID
            hr=obj.lpVtbl.QueryInterface(obj, &_id, <IObjRef**>&ppRet)
            #print(f"[FindChildByID2] QueryInterface GUID: {{{_id.Data1:08x}-{_id.Data2:04x}-{_id.Data3:04x}-{_id.Data4[0]:02x}{_id.Data4[1]:02x}-{_id.Data4[2]:02x}{_id.Data4[3]:02x}{_id.Data4[4]:02x}{_id.Data4[5]:02x}{_id.Data4[6]:02x}{_id.Data4[7]:02x}}},result: hr=0x{hr:08x}, pointer={<DWORD_PTR>ppRet:x}")
            # 检查 QueryInterface 是否成功 (S_OK = 0)
            if hr != 0 or ppRet == NULL:
                return None
            r_obj = classType(<DWORD_PTR>ppRet)
            r_obj.Release()
            return r_obj
        return classType(<DWORD_PTR>obj)

    # BOOL DestroyIChild(IWindow* this, IWindow * pChild)
    def DestroyChild(self, pChild):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DestroyIChild(this, <IWindow*><DWORD_PTR>pChild.ptr())

    # void DestroyAllChildren(IWindow* this)
    def DestroyAllChildren(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.DestroyAllChildren(this)

    # BOOL Destroy(IWindow* this)
    def Destroy(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Destroy(this)

    # IWindow* GetNextLayoutIChild(IWindow* this, const IWindow *pCurChild)
    def GetNextLayoutChild(self, pCurChild):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetNextLayoutIChild(this, <IWindow*><DWORD_PTR>pCurChild.ptr())
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # void GetChildrenLayoutRect(const IWindow* this, RECT* prc)
    def GetChildrenLayoutRect(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef RECT _rc
        this.lpVtbl.GetChildrenLayoutRect(this, &_rc)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

    # void GetDesiredSize(IWindow* this, SIZE* pSize, int nParentWid, int nParentHei)
    def GetDesiredSize(self, nParentWid, nParentHei):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef SIZE _sz
        this.lpVtbl.GetDesiredSize(this, &_sz, nParentWid, nParentHei)
        return {'cx': _sz.cx, 'cy': _sz.cy}

    # COLORREF GetBkgndColor(IWindow* this)
    def GetBkgndColor(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetBkgndColor(this)

    # void SetWindowText(IWindow* this, LPCTSTR lpszText)
    def SetWindowText(self, lpszText):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetWindowText(this, lpszText)

    # int GetWindowText(IWindow* this, TCHAR * pBuf, int nBufLen, BOOL bRawText)
    def GetWindowText(self, bRawText=True):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef int lenght = this.lpVtbl.GetWindowText(this, NULL, 0, <BOOL>bRawText) + 1
        cdef long size = lenght * sizeof(WCHAR)
        cdef WCHAR *buf = <WCHAR*>malloc(size)
        this.lpVtbl.GetWindowText(this, buf, lenght, <BOOL>bRawText)
        sret = str(buf)
        free(buf)
        return sret

    # DWORD GetState(IWindow* this)
    def GetState(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetState(this)

    # DWORD ModifyState(IWindow* this, DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate)
    def ModifyState(self, dwStateAdd, dwStateRemove, bUpdate):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ModifyState(this, dwStateAdd, dwStateRemove, <BOOL>bUpdate)

    # IWindow* GetISelectedSiblingInGroup(IWindow* this)
    def GetSelectedSiblingInGroup(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetISelectedSiblingInGroup(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # IWindow* GetISelectedChildInGroup(IWindow* this)
    def GetSelectedChildInGroup(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetISelectedChildInGroup(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # BOOL IsSiblingsAutoGroupped(IWindow* this)
    def IsSiblingsAutoGroupped(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsSiblingsAutoGroupped(this)

    # BOOL CreateCaret(IWindow* this, HBITMAP pBmp, int nWid, int nHeight)
    def CreateCaret(self, pBmp, nWid, nHeight):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CreateCaret(this, <HBITMAP>pBmp, nWid, nHeight)

    # void ShowCaret(IWindow* this, BOOL bShow)
    def ShowCaret(self, bShow):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ShowCaret(this, <BOOL>bShow)

    # void SetCaretPos(IWindow* this, int x, int y)
    def SetCaretPos(self, x, y):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetCaretPos(this, x, y)

    # void SetEventMute(IWindow* this, BOOL bMute)
    def SetEventMute(self, bMute):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetEventMute(this, <BOOL>bMute)

    # BOOL SubscribeEvent(IWindow* this, DWORD evtId, const IEvtSlot *pSlot)
    def SubscribeEvent(self, evtId, pSlot):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SubscribeEvent(this, evtId, <IEvtSlot*><DWORD_PTR>pSlot.ptr())

    # BOOL UnsubscribeEvent(IWindow* this, DWORD evtId, const IEvtSlot *pSlot)
    def UnsubscribeEvent(self, evtId, pSlot):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.UnsubscribeEvent(this, evtId, <IEvtSlot*><DWORD_PTR>pSlot.ptr())

    # BOOL FireEvent(IWindow* this, IEvtArgs * evt)
    def FireEvent(self, evt):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.FireEvent(this, <IEvtArgs*>evt)

    # BOOL FireCommand(IWindow* this)
    def FireCommand(self):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.FireCommand(this)

    # BOOL FireCtxMenu(IWindow* this, POINT pt)
    def FireCtxMenu(self, pt):
        cdef IWindow* this = <IWindow*><DWORD_PTR>self._thisptr
        cdef POINT _pt
        _pt.x, _pt.y = pt
        return <BOOL>this.lpVtbl.FireCtxMenu(this, _pt)

cdef class SNativeWnd(SObjRef):
    cdef object _msg_handler

    def __cinit__(self):
        self._msg_handler = None

    # HWND CreateNative(INativeWnd* this, LPCTSTR lpWindowName, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int nID, LPVOID lpParam)
    def CreateNative(self, lpWindowName, dwStyle, dwExStyle, x, y, nWidth, nHeight, hWndParent, nID, lpParam):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.CreateNative(this, lpWindowName, dwStyle, dwExStyle, x, y, nWidth, nHeight, <HWND><DWORD_PTR>hWndParent, nID, <LPVOID><DWORD_PTR>lpParam)

    # HWND GetHwnd(INativeWnd* this)
    def GetHwnd(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetHwnd(this)

    # BOOL SubclassWindow(INativeWnd* this, HWND hWnd)
    def SubclassWindow(self, hWnd):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SubclassWindow(this, <HWND><DWORD_PTR>hWnd)

    # HWND UnsubclassWindow(INativeWnd* this, BOOL bForce)
    def UnsubclassWindow(self, bForce):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.UnsubclassWindow(this, <BOOL>bForce)

    # const MSG* GetCurrentMessage(const INativeWnd* this)
    def GetCurrentMessage(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef const MSG* msg = this.lpVtbl.GetCurrentMessage(this)
        return {'hwnd': <DWORD_PTR>msg.hwnd, 'msg': msg.message, 'wParam': msg.wParam, 'lParam': msg.lParam, 'time': msg.time, 'pt': {'x': msg.pt.x, 'y': msg.pt.y}}

    # int GetDlgCtrlID(const INativeWnd* this)
    def GetDlgCtrlID(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDlgCtrlID(this)

    # DWORD GetStyle(const INativeWnd* this)
    def GetStyle(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetStyle(this)

    # DWORD GetExStyle(const INativeWnd* this)
    def GetExStyle(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetExStyle(this)

    # LONG_PTR GetWindowLongPtr(const INativeWnd* this, int nIndex)
    def GetWindowLongPtr(self, nIndex):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetWindowLongPtr(this, nIndex)

    # LONG_PTR SetWindowLongPtr(INativeWnd* this, int nIndex, LONG_PTR dwNewLong)
    def SetWindowLongPtr(self, nIndex, dwNewLong):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetWindowLongPtr(this, nIndex, dwNewLong)

    # HWND GetParent(INativeWnd* this)
    def GetParent(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetParent(this)

    # HWND SetParent(INativeWnd* this, HWND hWndNewParent)
    def SetParent(self, hWndNewParent):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.SetParent(this, <HWND><DWORD_PTR>hWndNewParent)

    # BOOL IsWindowEnabled(const INativeWnd* this)
    def IsWindowEnabled(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsWindowEnabled(this)

    # BOOL ModifyStyle(INativeWnd* this, DWORD dwRemove, DWORD dwAdd, UINT nFlags)
    def ModifyStyle(self, dwRemove, dwAdd, nFlags):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ModifyStyle(this, dwRemove, dwAdd, nFlags)

    # BOOL ModifyStyleEx(INativeWnd* this, DWORD dwRemove, DWORD dwAdd, UINT nFlags)
    def ModifyStyleEx(self, dwRemove, dwAdd, nFlags):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ModifyStyleEx(this, dwRemove, dwAdd, nFlags)

    # BOOL SetWindowPos(INativeWnd* this, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
    def SetWindowPos(self, hWndInsertAfter, x, y, cx, cy, nFlags):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetWindowPos(this, <HWND><DWORD_PTR>hWndInsertAfter, x, y, cx, cy, nFlags)

    # BOOL CenterWindow(INativeWnd* this, HWND hWndCenter)
    def CenterWindow(self, hWndCenter):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CenterWindow(this, <HWND>hWndCenter)

    # BOOL DestroyWindow(INativeWnd* this)
    def DestroyWindow(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DestroyWindow(this)

    # BOOL IsWindow(INativeWnd* this)
    def IsWindow(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsWindow(this)

    # BOOL Invalidate(INativeWnd* this, BOOL bErase)
    def Invalidate(self, bErase):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Invalidate(this, <BOOL>bErase)

    # BOOL InvalidateRect(INativeWnd* this, LPCRECT lpRect, BOOL bErase)
    def InvalidateRect(self, lpRect, bErase):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect = RECT(lpRect['left'], lpRect['top'], lpRect['right'], lpRect['bottom'])
        return <BOOL>this.lpVtbl.InvalidateRect(this, &_lpRect, <BOOL>bErase)

    # BOOL GetWindowRect(const INativeWnd* this, LPRECT lpRect)
    def GetWindowRect(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect
        if this.lpVtbl.GetWindowRect(this, &_lpRect):
            return {'left': _lpRect.left, 'top': _lpRect.top, 'right': _lpRect.right, 'bottom': _lpRect.bottom}

    # BOOL GetClientRect(const INativeWnd* this, LPRECT lpRect)
    def GetClientRect(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect
        if this.lpVtbl.GetClientRect(this, &_lpRect):
            return {'left': _lpRect.left, 'top': _lpRect.top, 'right': _lpRect.right, 'bottom': _lpRect.bottom}

    # BOOL ClientToScreen(const INativeWnd* this, LPPOINT lpPoint)
    def ClientToScreen(self, lpPoint):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef POINT _lpPoint = POINT(lpPoint['x'], lpPoint['y'])
        if this.lpVtbl.ClientToScreen(this, &_lpPoint):
            return {'x': _lpPoint.x, 'y': _lpPoint.y}

    # BOOL ClientToScreen2(const INativeWnd* this, LPRECT lpRect)
    def ClientToScreen2(self, lpRect):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect = RECT(lpRect['left'], lpRect['top'], lpRect['right'], lpRect['bottom'])
        if this.lpVtbl.ClientToScreen2(this, &_lpRect):
            return {'left': _lpRect.left, 'top': _lpRect.top, 'right': _lpRect.right, 'bottom': _lpRect.bottom}

    # BOOL ScreenToClient(const INativeWnd* this, LPPOINT lpPoint)
    def ScreenToClient(self, lpPoint):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef POINT _lpPoint = POINT(lpPoint['x'], lpPoint['y'])
        if this.lpVtbl.ScreenToClient(this, &_lpPoint):
            return {'x': _lpPoint.x, 'y': _lpPoint.y}

    # BOOL ScreenToClient2(const INativeWnd* this, LPRECT lpRect)
    def ScreenToClient2(self, lpRect):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect = RECT(lpRect['left'], lpRect['top'], lpRect['right'], lpRect['bottom'])
        if this.lpVtbl.ScreenToClient2(this, &_lpRect):
            return {'left': _lpRect.left, 'top': _lpRect.top, 'right': _lpRect.right, 'bottom': _lpRect.bottom}

    # int MapWindowPoints(const INativeWnd* this, HWND hWndTo, LPPOINT lpPoint, UINT nCount)
    def MapWindowPoints(self, hWndTo, lpPoint, nCount):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef POINT _lpPoint = POINT(lpPoint['x'], lpPoint['y'])
        iRet = this.lpVtbl.MapWindowPoints(this, <HWND><DWORD_PTR>hWndTo, &_lpPoint, nCount)
        return {'result': iRet, 'x': _lpPoint.x, 'y': _lpPoint.y}

    # int MapWindowRect(const INativeWnd* this, HWND hWndTo, LPRECT lpRect)
    def MapWindowRect(self, hWndTo, lpRect):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect = RECT(lpRect['left'], lpRect['top'], lpRect['right'], lpRect['bottom'])
        iRet = this.lpVtbl.MapWindowRect(this, <HWND><DWORD_PTR>hWndTo, &_lpRect)
        return {'result': iRet, 'left': _lpRect.left, 'top': _lpRect.top, 'right': _lpRect.right, 'bottom': _lpRect.bottom}

    # UINT_PTR SetTimer(INativeWnd* this, UINT_PTR nIDEvent, UINT nElapse, FunTimerCallBack lpfnTimer)
    def SetTimer(self, nIDEvent, nElapse):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetTimer(this, <UINT_PTR>nIDEvent, <UINT>nElapse, NULL)

    # BOOL KillTimer(INativeWnd* this, UINT_PTR nIDEvent)
    def KillTimer(self, nIDEvent):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.KillTimer(this, <UINT_PTR>nIDEvent)

    # HDC GetDC(INativeWnd* this)
    def GetDC(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetDC(this)

    # HDC GetWindowDC(INativeWnd* this)
    def GetWindowDC(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetWindowDC(this)

    # int ReleaseDC(INativeWnd* this, HDC hDC)
    def ReleaseDC(self, hDC):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.ReleaseDC(this, <HDC>hDC)

    # BOOL CreateCaret(INativeWnd* this, HBITMAP hBitmap, int nWidth, int nHeight)
    def CreateCaret(self, hBitmap, nWidth, nHeight):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CreateCaret(this, <HBITMAP><DWORD_PTR>hBitmap, nWidth, nHeight)

    # BOOL HideCaret(INativeWnd* this)
    def HideCaret(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.HideCaret(this)

    # BOOL ShowCaret(INativeWnd* this)
    def ShowCaret(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ShowCaret(this)

    # HWND GetCapture(INativeWnd* this)
    def GetCapture(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetCapture(this)

    # HWND SetCapture(INativeWnd* this)
    def SetCapture(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.SetCapture(this)

    # BOOL ReleaseCapture(INativeWnd* this)
    def ReleaseCapture(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ReleaseCapture(this)

    # HWND SetFocus(INativeWnd* this)
    def SetFocus(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.SetFocus(this)

    # LRESULT SendMessage(INativeWnd* this, UINT message, WPARAM wParam, LPARAM lParam)
    def SendMessage(self, message, wParam=0, lParam=0):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SendMessage(this, message, wParam, lParam)

    # BOOL PostMessage(INativeWnd* this, UINT message, WPARAM wParam, LPARAM lParam)
    def PostMessage(self, message, wParam, lParam):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.PostMessage(this, message, wParam, lParam)

    # BOOL SendNotifyMessage(INativeWnd* this, UINT message, WPARAM wParam, LPARAM lParam)
    def SendNotifyMessage(self, message, wParam, lParam):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SendNotifyMessage(this, message, wParam, lParam)

    # BOOL SetWindowText(INativeWnd* this, LPCTSTR lpszString)
    def SetWindowText(self, lpszString):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetWindowText(this, lpszString)

    # int GetWindowText(const INativeWnd* this, LPTSTR lpszStringBuf, int nMaxCount)
    def GetWindowText(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef int lenght = this.lpVtbl.GetWindowText(this, NULL, 0) + 1
        cdef long size = lenght * sizeof(WCHAR)
        cdef WCHAR *buf = <WCHAR*>malloc(size)
        this.lpVtbl.GetWindowText(this, buf, lenght)
        sret = str(buf)
        free(buf)
        return sret

    # BOOL IsIconic(const INativeWnd* this)
    def IsIconic(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsIconic(this)

    # BOOL IsZoomed(const INativeWnd* this)
    def IsZoomed(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsZoomed(this)

    # BOOL IsWindowVisible(const INativeWnd* this)
    def IsWindowVisible(self):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsWindowVisible(this)

    # BOOL MoveWindow(INativeWnd* this, int x, int y, int nWidth, int nHeight, BOOL bRepaint)
    def MoveWindow(self, x, y, nWidth, nHeight, bRepaint):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.MoveWindow(this, x, y, nWidth, nHeight, <BOOL>bRepaint)

    # BOOL MoveWindow2(INativeWnd* this, LPCRECT lpRect, BOOL bRepaint)
    def MoveWindow2(self, lpRect, bRepaint):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        cdef RECT _lpRect = RECT(lpRect['left'], lpRect['top'], lpRect['right'], lpRect['bottom'])
        return <BOOL>this.lpVtbl.MoveWindow2(this, &_lpRect, <BOOL>bRepaint)

    # BOOL ShowWindow(INativeWnd* this, int nCmdShow)
    def ShowWindow(self, nCmdShow):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ShowWindow(this, nCmdShow)

    # int SetWindowRgn(INativeWnd* this, HRGN hRgn, BOOL bRedraw)
    def SetWindowRgn(self, hRgn, bRedraw):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetWindowRgn(this, <HRGN>hRgn, <BOOL>bRedraw)

    # BOOL SetLayeredWindowAttributes(INativeWnd* this, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)
    def SetLayeredWindowAttributes(self, crKey, bAlpha, dwFlags):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetLayeredWindowAttributes(this, <COLORREF>crKey, <BYTE>bAlpha, dwFlags)

    # # BOOL UpdateLayeredWindow(INativeWnd* this, HDC hdcDst, POINT* pptDst, SIZE* psize, HDC hdcSrc, POINT* pptSrc, COLORREF crKey, BLENDFUNCTION* pblend, DWORD dwFlags)
    # def UpdateLayeredWindow(self, hdcDst, hdcSrc, crKey, pblend, dwFlags):
    #     cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
    #     cdef POINT _pptDst
    #     cdef SIZE _psize
    #     cdef POINT _pptSrc
    #     return <BOOL>this.lpVtbl.UpdateLayeredWindow(this, <HDC>hdcDst, &_pptDst, &_psize, <HDC>hdcSrc, &_pptSrc, <COLORREF>crKey, <BLENDFUNCTION*>pblend, dwFlags)

    # # MsgHandlerInfo* GetMsgHandler(INativeWnd* this)
    # def GetMsgHandler(self):
    #     cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
    #     return <DWORD_PTR>this.lpVtbl.GetMsgHandler(this)

    def GetMsgHandler(self):
        return self._msg_handler

    def SetMsgHandler(self, msg_handler):
        cdef INativeWnd* this = <INativeWnd*><DWORD_PTR>self._thisptr
        self._msg_handler = msg_handler
        if msg_handler is not None:
            this.lpVtbl.SetMsgHandler(this, OnMsgHandler, <void*><PyObject*>self)
        else:
            this.lpVtbl.SetMsgHandler(this, OnMsgHandler, <void*><PyObject*>None)

    property _hWnd:
        def __get__(self):
            return self.GetHwnd()

cdef class SHostWnd(SNativeWnd):
    cdef object _event_handler

    def __cinit__(self):
        self._event_handler = None

    # HWND CreateEx(IHostWnd* this, HWND hWndParent, DWORD dwStyle, DWORD dwExStyle, int x, int y, int nWidth, int nHeight, IXmlNode* pXmlNode)
    def CreateEx(self, hWndParent, dwStyle, dwExStyle, x, y, nWidth, nHeight, pXmlNode=None):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.CreateEx(this, <HWND><DWORD_PTR>hWndParent, dwStyle, dwExStyle, x, y, nWidth, nHeight, <IXmlNode*><DWORD_PTR>pXmlNode)

    # HWND Create(IHostWnd* this, HWND hWndParent, int x, int y, int nWidth, int nHeight)
    def Create(self, hWndParent=0, x=0, y=0, nWidth=0, nHeight=0):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.Create(this, <HWND><DWORD_PTR>hWndParent, x, y, nWidth, nHeight)

    # void SetLayoutId(IHostWnd* this, LPCTSTR pszLayoutId)
    def SetLayoutId(self, pszLayoutId):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetLayoutId(this, pszLayoutId)

    # IWindow* GetIRoot(IHostWnd* this)
    def GetRoot(self):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIRoot(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    # IWindow* FindIChildByID(IHostWnd* this, int nId)
    def FindChildByID(self, nId):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByID(this, nId)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

    def FindChildByID2(self, nId, classType):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByID(this, nId)
        cdef IWindow* ppRet = NULL
        cdef GUID _id
        cdef HRESULT hr
        if obj == NULL:
            return None
        if hasattr(classType, 'IID'):
            _id.Data1, _id.Data2, _id.Data3, _id.Data4[:] = classType.IID
            hr = obj.lpVtbl.QueryInterface(obj, &_id, <IObjRef**>&ppRet)
            #print(f"[FindChildByID2] QueryInterface GUID: {{{_id.Data1:08x}-{_id.Data2:04x}-{_id.Data3:04x}-{_id.Data4[0]:02x}{_id.Data4[1]:02x}-{_id.Data4[2]:02x}{_id.Data4[3]:02x}{_id.Data4[4]:02x}{_id.Data4[5]:02x}{_id.Data4[6]:02x}{_id.Data4[7]:02x}}},result: hr=0x{hr:08x}, pointer={<DWORD_PTR>ppRet:x}")
            # 检查 QueryInterface 是否成功 (S_OK = 0)
            if hr != 0 or ppRet == NULL:
                return None
            r_obj = classType(<DWORD_PTR>ppRet)
            r_obj.Release()
            return r_obj
        return classType(<DWORD_PTR>obj)

    # IWindow* FindIChildByName(IHostWnd* this, LPCWSTR pszName)
    def FindChildByName(self, pszName):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.FindIChildByName(this, pszName)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)
    
    def FindChildByName2(self, pszName, classType):
        cdef IHostWnd* this
        cdef IWindow* obj
        cdef IWindow* ppRet = NULL
        cdef GUID _id
        cdef HRESULT hr
        
        #print(f"[FindChildByName2] Input parameters: pszName={pszName}, classType={classType.__name__}")
        
        this = <IHostWnd*><DWORD_PTR>self._thisptr        
        obj = this.lpVtbl.FindIChildByName(this, pszName)        
        if obj == NULL:
            print("[FindChildByName2] No child named {pszName} window found")
            return None
            
        if hasattr(classType, 'IID'):
            _id.Data1, _id.Data2, _id.Data3, _id.Data4[:] = classType.IID
            hr = obj.lpVtbl.QueryInterface(obj, &_id, <IObjRef**>&ppRet)
            #print(f"[FindChildByName2] QueryInterface GUID: {{{_id.Data1:08x}-{_id.Data2:04x}-{_id.Data3:04x}-{_id.Data4[0]:02x}{_id.Data4[1]:02x}-{_id.Data4[2]:02x}{_id.Data4[3]:02x}{_id.Data4[4]:02x}{_id.Data4[5]:02x}{_id.Data4[6]:02x}{_id.Data4[7]:02x}}},result: hr=0x{hr:08x}, pointer={<DWORD_PTR>ppRet:x}")
            if hr != 0 or ppRet == NULL:
                return None
                
            # 创建Python包装对象
            r_obj = classType(<DWORD_PTR>ppRet)
            # 释放COM引用计数
            r_obj.Release()
            return r_obj
            
        # 如果不需要接口查询，直接创建Python包装对象
        return classType(<DWORD_PTR>obj)

    # INcPainter* GetNcPainter(IHostWnd* this)
    def GetNcPainter(self):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        cdef INcPainter* obj = this.lpVtbl.GetNcPainter(this)
        if obj != NULL:
            return SNcPainter(<DWORD_PTR>obj)

    # BOOL ShowWindow(IHostWnd* this, int nCmdShow)
    def ShowWindow(self, nCmdShow):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        if nCmdShow == 1:
            SetActiveWindow(<HWND><DWORD_PTR>self._hWnd)
        return <BOOL>this.lpVtbl.ShowWindow(this, nCmdShow)

    def GetEventHandler(self):
        return self._event_handler

    def SetEventHandler(self, event_handler):
        cdef IHostWnd* this = <IHostWnd*><DWORD_PTR>self._thisptr
        self._event_handler = event_handler
        if event_handler is not None:
            this.lpVtbl.SetEventHandler(this, OnEventHandler, <void*><PyObject*>self)
        else:
            this.lpVtbl.SetEventHandler(this, OnEventHandler, <void*><PyObject*>None)

cdef class SHostDialog(SHostWnd):
    # INT_PTR DoModal(IHostDialog* this, HWND hParent)
    def DoModal(self, hParent=0):
        cdef IHostDialog* this = <IHostDialog*><DWORD_PTR>self._thisptr
        cdef HWND _hParent = NULL
        nRet = this.lpVtbl.DoModal(this, <HWND><DWORD_PTR>hParent, 0x82000000, 0)
        return nRet

    # void EndDialog(IHostDialog* this, INT_PTR nResult)
    def EndDialog(self, nResult):
        cdef IHostDialog* this = <IHostDialog*><DWORD_PTR>self._thisptr
        return this.lpVtbl.EndDialog(this, nResult)

cdef class SEvtArgs(SObject):
    def Sender(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return SObject(<DWORD_PTR>this.lpVtbl.Sender(this))

    def IdFrom(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return this.lpVtbl.IdFrom(this)

    def SetIdFrom(self, id):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetIdFrom(this, id)

    def NameFrom(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return this.lpVtbl.NameFrom(this)

    def SetNameFrom(self, name):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetNameFrom(this, name)

    def IsBubbleUp(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsBubbleUp(this)

    def SetBubbleUp(self, bBubbleUp):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetBubbleUp(this, <BOOL>bBubbleUp)

    def HandleCount(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return this.lpVtbl.HandleCount(this)

    def IncreaseHandleCount(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        this.lpVtbl.IncreaseHandleCount(this)

    def Data(self):
        cdef IEvtArgs* this = <IEvtArgs*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.Data(this)

cdef class SEvtSlot(SObjRef):
    # BOOL Run(IEvtSlot* this, IEvtArgs* pArg)
    def Run(self, pArg):
        cdef IEvtSlot* this = <IEvtSlot*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Run(this, <IEvtArgs*><DWORD_PTR>pArg.ptr())

    # IEvtSlot* Clone(IEvtSlot* this)
    def Clone(self):
        cdef IEvtSlot* this = <IEvtSlot*><DWORD_PTR>self._thisptr
        return SEvtSlot(<DWORD_PTR>this.lpVtbl.Clone(this))

    # BOOL Equal(IEvtSlot* this, const IEvtSlot*sour)
    def Equal(self, sour):
        cdef IEvtSlot* this = <IEvtSlot*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Equal(this, <const IEvtSlot*><DWORD_PTR>sour.ptr())

    # UINT GetSlotType(IEvtSlot* this)
    def GetSlotType(self):
        cdef IEvtSlot* this = <IEvtSlot*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSlotType(this)

cdef class SMenu(SObjRef):
    # BOOL Attach(IMenu* this, HMENU hMenu)
    def Attach(self, hMenu):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Attach(this, <HMENU><DWORD_PTR>hMenu)

    # HMENU Detach(IMenu* this)
    def Detach(self):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.Detach(this)

    # HMENU GetHMenu(IMenu* this)
    def GetHMenu(self):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetHMenu(this)

    # BOOL LoadMenu(IMenu* this, LPCTSTR resId)
    def LoadMenu(self, resId):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadMenu(this, resId)

    # BOOL LoadMenu2(IMenu* this, IXmlNode*xmlMenu)
    def LoadMenu2(self, xmlMenu):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadMenu2(this, <IXmlNode*><DWORD_PTR>xmlMenu.ptr())

    # void SetIconSkin(IMenu* this, ISkinObj* icons)
    def SetIconSkin(self, icons):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetIconSkin(this, <ISkinObj*><DWORD_PTR>icons)

    # BOOL InsertMenu(IMenu* this, UINT uPosition,UINT uFlags,UINT_PTR nIDNewItem,LPCTSTR strText,int iIcon,HICON hIcon)
    def InsertMenu(self, uPosition, uFlags, nIDNewItem, strText, iIcon, hIcon):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.InsertMenu(this, uPosition, uFlags, <UINT_PTR>nIDNewItem, strText, iIcon, <HICON><DWORD_PTR>hIcon)

    # BOOL AppendMenu(IMenu* this, UINT uFlags,UINT_PTR uIDNewItem,LPCTSTR lpNewItem,int iIcon,HICON hIcon)
    def AppendMenu(self, uFlags, uIDNewItem, lpNewItem, iIcon, hIcon):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AppendMenu(this, uFlags, <UINT_PTR>uIDNewItem, lpNewItem, iIcon, <HICON><DWORD_PTR>hIcon)

    # BOOL CheckMenuItem(IMenu* this, UINT uIdCheckItem, UINT uCheck)
    def CheckMenuItem(self, uIdCheckItem, uCheck):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CheckMenuItem(this, uIdCheckItem, uCheck)

    # BOOL CheckMenuRadioItem(IMenu* this, UINT idFirst,UINT idLast,UINT idCheck,UINT uFlags)
    def CheckMenuRadioItem(self, idFirst, idLast, idCheck, uFlags):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CheckMenuRadioItem(this, idFirst, idLast, idCheck, uFlags)

    # BOOL DeleteMenu(IMenu* this, UINT uPosition, UINT uFlags)
    def DeleteMenu(self, uPosition, uFlags):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DeleteMenu(this, uPosition, uFlags)

    # UINT TrackPopupMenu(IMenu* this, UINT uFlags,int x,int y,HWND hWnd,int nScale)
    def TrackPopupMenu(self, uFlags, x, y, hWnd, nScale=100):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        cdef RECT _prcRect
        uRet = this.lpVtbl.TrackPopupMenu(this, uFlags, x, y, <HWND><DWORD_PTR>hWnd, NULL, nScale)
        return uRet

    # void DestroyMenu(IMenu* this)
    def DestroyMenu(self):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        this.lpVtbl.DestroyMenu(this)

    # BOOL ModifyMenuString(IMenu* this, UINT uPosition, UINT uFlags, LPCTSTR lpItemString)
    def ModifyMenuString(self, uPosition, uFlags, lpItemString):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ModifyMenuString(this, uPosition, uFlags, lpItemString)

    # BOOL SetMenuUserData(IMenu* this, UINT uPosition, UINT uFlags, ULONG_PTR ulUserData)
    def SetMenuUserData(self, uPosition, uFlags, ulUserData):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetMenuUserData(this, uPosition, uFlags, ulUserData)

    # ULONG_PTR GetMenuUserData(IMenu* this, UINT uPosition, UINT uFlags)
    def GetMenuUserData(self, uPosition, uFlags):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetMenuUserData(this, uPosition, uFlags)

    # DWORD GetContextHelpId(IMenu* this)
    def GetContextHelpId(self):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetContextHelpId(this)

    # void SetContextHelpId(IMenu* this, DWORD dwId)
    def SetContextHelpId(self, dwId):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetContextHelpId(this, dwId)

    # HMENU GetSubMenu(IMenu* this, int nPos)
    def GetSubMenu(self, nPos):
        cdef IMenu* this = <IMenu*><DWORD_PTR>self._thisptr
        return <DWORD_PTR>this.lpVtbl.GetSubMenu(this, nPos)

cdef class SMenuEx(SObjRef):
    # BOOL LoadMenu(IMenuEx* this, LPCTSTR resId)
    def LoadMenu(self, resId):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadMenu(this, resId)

    # BOOL LoadMenu2(IMenuEx* this, IXmlNode*xmlMenu)
    def LoadMenu2(self, xmlMenu):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.LoadMenu2(this, <IXmlNode*><DWORD_PTR>xmlMenu.ptr())

    # BOOL InsertMenu(IMenuEx* this, UINT uPosition, UINT uFlags, int id, LPCTSTR strText, int iIcon)
    def InsertMenu(self, uPosition, uFlags, id, strText, iIcon):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.InsertMenu(this, uPosition, uFlags, id, strText, iIcon)

    # BOOL AppendMenu(IMenuEx* this, UINT uFlags, int id, LPCTSTR lpNewItem, int iIcon)
    def AppendMenu(self, uFlags, id, lpNewItem, iIcon):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.AppendMenu(this, uFlags, id, lpNewItem, iIcon)

    # BOOL CheckMenuItem(IMenuEx* this, UINT uIdCheckItem, UINT uCheck)
    def CheckMenuItem(self, uIdCheckItem, uCheck):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CheckMenuItem(this, uIdCheckItem, uCheck)

    # BOOL CheckMenuRadioItem(IMenuEx* this, UINT idFirst,UINT idLast,UINT idCheck,UINT uFlags)
    def CheckMenuRadioItem(self, idFirst, idLast, idCheck, uFlags):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.CheckMenuRadioItem(this, idFirst, idLast, idCheck, uFlags)

    # BOOL DeleteMenu(IMenuEx* this, UINT uPosition, UINT uFlags)
    def DeleteMenu(self, uPosition, uFlags):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DeleteMenu(this, uPosition, uFlags)

    # UINT TrackPopupMenu(IMenuEx* this, UINT uFlags, int x, int y, HWND hWnd, int nScale)
    def TrackPopupMenu(self, uFlags, x, y, hWnd, nScale=0):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        uRet = this.lpVtbl.TrackPopupMenu(this, uFlags, x, y, <HWND><DWORD_PTR>hWnd, nScale)
        return uRet

    # void DestroyMenu(IMenuEx* this)
    def DestroyMenu(self):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        this.lpVtbl.DestroyMenu(this)

    # BOOL ModifyMenuString(IMenuEx* this, UINT uPosition, UINT uFlags, LPCTSTR lpItemString)
    def ModifyMenuString(self, uPosition, uFlags, lpItemString):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ModifyMenuString(this, uPosition, uFlags, lpItemString)

    # BOOL SetMenuUserData(IMenuEx* this, UINT uPosition, UINT uFlags, ULONG_PTR ulUserData)
    def SetMenuUserData(self, uPosition, uFlags, ulUserData):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetMenuUserData(this, uPosition, uFlags, ulUserData)

    # ULONG_PTR GetMenuUserData(IMenuEx* this, UINT uPosition, UINT uFlags)
    def GetMenuUserData(self, uPosition, uFlags):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetMenuUserData(this, uPosition, uFlags)

    # DWORD GetContextHelpId(IMenuEx* this)
    def GetContextHelpId(self):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetContextHelpId(this)

    # void SetContextHelpId(IMenuEx* this, DWORD dwId)
    def SetContextHelpId(self, dwId):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetContextHelpId(this, dwId)

    # IMenuEx* GetSubMenu(IMenuEx* this, int nPos)
    def GetSubMenu(self, nPos):
        cdef IMenuEx* this = <IMenuEx*><DWORD_PTR>self._thisptr
        cdef IMenuEx* obj = this.lpVtbl.GetSubMenu(this, nPos)
        if obj != NULL:
            return SMenuEx(<DWORD_PTR>obj)

cdef class SCtrl(SObjRef):
    # IWindow* ToIWindow(ICtrl* this)
    def ToWindow(self):
        cdef ICtrl* this = <ICtrl*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.ToIWindow(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)

cdef class SOsrPanel(SCtrl):
    IID =(0x36D49C0A, 0xCCBA, 0x4238, [0x98,0xE2,0xB6,0xAC,0xB1,0x88,0x24,0xB5])

    # void SetItemIndex(IOsrPanel* this, LPARAM index)
    def SetItemIndex(self, index):
        cdef IOsrPanel* this = <IOsrPanel*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemIndex(this, index)

    # LPARAM GetItemIndex(const IOsrPanel* this)
    def GetItemIndex(self):
        cdef IOsrPanel* this = <IOsrPanel*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemIndex(this)

    # void SetItemData(IOsrPanel* this, LPARAM dwData)
    def SetItemData(self, dwData):
        cdef IOsrPanel* this = <IOsrPanel*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemData(this, dwData)

    # LPARAM GetItemData(const IOsrPanel* this)
    def GetItemData(self):
        cdef IOsrPanel* this = <IOsrPanel*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemData(this)

cdef class SItemPanel(SOsrPanel):
    IID =(0xf78ca81b, 0x729b, 0x4fe5, [0xb3, 0xfe, 0x6c, 0x70, 0xad, 0x36, 0x30, 0x17])

    # void SetSkin(IItemPanel* this, ISkinObj* pSkin)
    def SetSkin(self, pSkin):
        cdef IItemPanel* this = <IItemPanel*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSkin(this, <ISkinObj*><DWORD_PTR>pSkin.ptr())

    # void SetColor(IItemPanel* this, COLORREF crBk, COLORREF crSelBk)
    def SetColor(self, crBk, crSelBk):
        cdef IItemPanel* this = <IItemPanel*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetColor(this, <COLORREF>crBk, <COLORREF>crSelBk)

cdef class SImageWnd(SCtrl):
    IID =(0x310a0c73, 0x1dca, 0x4ac2, [0xb6,0xc9,0x56,0x9b,0x0e,0xa4,0x04,0x96])

    # BOOL SetSkin(IImageWnd* this, ISkinObj* pSkin, int iFrame, BOOL bAutoFree)
    def SetSkin(self, pSkin, iFrame, bAutoFree):
        cdef IImageWnd* this = <IImageWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetSkin(this, <ISkinObj*>pSkin, iFrame, <BOOL>bAutoFree)

    # ISkinObj* GetSkin(IImageWnd* this)
    def GetSkin(self):
        cdef IImageWnd* this = <IImageWnd*><DWORD_PTR>self._thisptr
        cdef ISkinObj* obj = this.lpVtbl.GetSkin(this)
        if obj != NULL:
            return SSkinObj(<DWORD_PTR>obj)

    # void SetImage(IImageWnd* this, IBitmapS* pBitmap, FilterLevel fl)
    def SetImage(self, pBitmap, fl=kNone_FilterLevel):
        cdef IImageWnd* this = <IImageWnd*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetImage(this, <IBitmapS*><DWORD_PTR>pBitmap.ptr(), <FilterLevel>fl)

    # IBitmapS* GetImage(IImageWnd* this)
    def GetImage(self):
        cdef IImageWnd* this = <IImageWnd*><DWORD_PTR>self._thisptr
        cdef IBitmapS* obj = this.lpVtbl.GetImage(this)
        if obj != NULL:
            return SBitmapS(<DWORD_PTR>obj)

    # BOOL SetIcon(IImageWnd* this, int nSubID)
    def SetIcon(self, nSubID):
        cdef IImageWnd* this = <IImageWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetIcon(this, nSubID)

cdef class SAnimateImgWnd(SCtrl):
    IID =(0xc2378093, 0xcb34, 0x4811, [0x98,0xd1,0xa7,0x21,0x63,0x7b,0x3b,0x87])

    # void Start(IAnimateImgWnd* this)
    def Start(self):
        cdef IAnimateImgWnd* this = <IAnimateImgWnd*><DWORD_PTR>self._thisptr
        this.lpVtbl.Start(this)

    # void Stop(IAnimateImgWnd* this)
    def Stop(self):
        cdef IAnimateImgWnd* this = <IAnimateImgWnd*><DWORD_PTR>self._thisptr
        this.lpVtbl.Stop(this)

    # BOOL IsPlaying(const IAnimateImgWnd* this)
    def IsPlaying(self):
        cdef IAnimateImgWnd* this = <IAnimateImgWnd*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsPlaying(this)

cdef class SProgress(SCtrl):
    IID =(0x0a572106, 0x14e0, 0x48d7, [0x85,0xc3,0x3e,0x08,0xb9,0xda,0x85,0xa8])

    # BOOL SetValue(IProgress* this, int nValue)
    def SetValue(self, nValue):
        cdef IProgress* this = <IProgress*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetValue(this, nValue)

    # int GetValue(const IProgress* this)
    def GetValue(self):
        cdef IProgress* this = <IProgress*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetValue(this)

    # void SetRange(IProgress* this, int nMin, int nMax)
    def SetRange(self, nMin, nMax):
        cdef IProgress* this = <IProgress*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetRange(this, nMin, nMax)

    # void GetRange(const IProgress* this, int*pMin, int*pMax)
    def GetRange(self, pMin, pMax):
        cdef IProgress* this = <IProgress*><DWORD_PTR>self._thisptr
        cdef int _nMin, _nMax
        this.lpVtbl.GetRange(this, &_nMin, &_nMax)
        return {'min': _nMin, 'max': _nMax}

    # BOOL IsVertical(const IProgress* this)
    def IsVertical(self):
        cdef IProgress* this = <IProgress*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsVertical(this)

cdef class SIconWnd(SCtrl):
    IID =(0x5dbacd74, 0x1a55, 0x45bc, [0x94, 0x05, 0x6f, 0x45, 0x36, 0x6e, 0xd7, 0x61])

    # void SetIcon(IIconWnd* this, HICON hIcon)
    def SetIcon(self, hIcon):
        cdef IIconWnd* this = <IIconWnd*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetIcon(this, <HICON><DWORD_PTR>hIcon)

cdef class SPanel(SCtrl):
    IID =(0x8de0a6c5, 0x9cbc, 0x465f, [0xb7,0x84,0xeb,0xa4,0xcb,0x8a,0xe6,0xd9])

    # BOOL ShowScrollBar(IPanel* this, int wBar, BOOL bShow)
    def ShowScrollBar(self, wBar, bShow):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ShowScrollBar(this, wBar, <BOOL>bShow)

    # BOOL EnableScrollBar(IPanel* this, int wBar, BOOL bEnable)
    def EnableScrollBar(self, wBar, bEnable):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.EnableScrollBar(this, wBar, <BOOL>bEnable)

    # BOOL IsScrollBarEnable(IPanel* this, BOOL bVertical)
    def IsScrollBarEnable(self, bVertical):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsScrollBarEnable(this, <BOOL>bVertical)

    # void SetScrollInfo(IPanel* this, SCROLLINFO si, BOOL bVertical)
    def SetScrollInfo(self, si, bVertical):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        # this.lpVtbl.SetScrollInfo(this, <SCROLLINFO>si, <BOOL>bVertical)

    # BOOL SetScrollPos(IPanel* this, BOOL bVertical, int nNewPos, BOOL bRedraw)
    def SetScrollPos(self, bVertical, nNewPos, bRedraw):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetScrollPos(this, <BOOL>bVertical, nNewPos, <BOOL>bRedraw)

    # int GetScrollPos(IPanel* this, BOOL bVertical)
    def GetScrollPos(self, bVertical):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScrollPos(this, <BOOL>bVertical)

    # BOOL SetScrollRange(IPanel* this, BOOL bVertical, int nMinPos, int nMaxPos, BOOL bRedraw)
    def SetScrollRange(self, bVertical, nMinPos, nMaxPos, bRedraw):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetScrollRange(this, <BOOL>bVertical, nMinPos, nMaxPos, <BOOL>bRedraw)

    # BOOL GetScrollRange(IPanel* this, BOOL bVertical, LPINT lpMinPos, LPINT lpMaxPos)
    def GetScrollRange(self, bVertical, lpMinPos, lpMaxPos):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        cdef int minPos, maxPos
        if this.lpVtbl.GetScrollRange(this, <BOOL>bVertical, &minPos, &maxPos):
            return {'min': minPos, 'max': maxPos}

    # BOOL HasScrollBar(IPanel* this, BOOL bVertical)
    def HasScrollBar(self, bVertical):
        cdef IPanel* this = <IPanel*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.HasScrollBar(this, <BOOL>bVertical)

cdef class SScrollView(SPanel):
    IID =( 0xf7a4a172, 0x31b2, 0x4597, [0x9d, 0xe5, 0xf6, 0x21, 0x60, 0x72, 0x37, 0x33])

    # void GetViewSize(const IScrollView* this, LPSIZE pszView)
    def GetViewSize(self):
        cdef IScrollView* this = <IScrollView*><DWORD_PTR>self._thisptr
        cdef SIZE _sz
        this.lpVtbl.GetViewSize(this, &_sz)
        return {'cx': _sz.cx, 'cy': _sz.cy}

    # void SetViewSize(IScrollView* this, SIZE szView)
    def SetViewSize(self, szView):
        cdef IScrollView* this = <IScrollView*><DWORD_PTR>self._thisptr
        cdef SIZE _szView = SIZE(szView['cx'], szView['cy'])
        this.lpVtbl.SetViewSize(this, _szView)

    # void GetViewOrigin(const IScrollView* this, LPPOINT pptView)
    def GetViewOrigin(self):
        cdef IScrollView* this = <IScrollView*><DWORD_PTR>self._thisptr
        cdef POINT _pt
        this.lpVtbl.GetViewOrigin(this, &_pt)
        return {'x': _pt.x, 'y': _pt.y}

    # void SetViewOrigin(IScrollView* this, POINT pt)
    def SetViewOrigin(self, pt):
        cdef IScrollView* this = <IScrollView*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        this.lpVtbl.SetViewOrigin(this, _pt)

cdef class SHeaderCtrl(SCtrl):
    IID =(0xee19aa27, 0x7c36, 0x4426, [0x87,0x00,0x8f,0xbc,0xb0,0xc7,0x38,0xf5])

    # int InsertItem(IHeaderCtrl* this, int iItem, LPCTSTR pszText, int nWidth, UINT fmt, LPARAM lParam, BOOL bDpiAware, float fWeight)
    def InsertItem(self, iItem, pszText, nWidth, fmt, lParam, bDpiAware, fWeight):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertItem(this, iItem, pszText, nWidth, fmt, lParam, <BOOL>bDpiAware, fWeight)

    # BOOL GetItem(const IHeaderCtrl* this, int iItem, SHDITEM*pItem)
    def GetItem(self, iItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        cdef SHDITEM _item
        if this.lpVtbl.GetItem(this, iItem, &_item):
            return {'mask': _item.mask, 'cx': _item.cx, 'fmt': _item.fmt, 'state': _item.state,
                    'iOrder': _item.iOrder, 'pszText': _item.pszText, 'cchMaxText': _item.cchMaxText,
                    'lParam': _item.lParam, 'bDpiAware': _item.bDpiAware, 'bVisible': _item.bVisible, 'fWeight': _item.fWeight}

    # BOOL SetItem(IHeaderCtrl* this, int iItem, const SHDITEM*pItem)
    def SetItem(self, iItem, pItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        cdef SHDITEM _item = SHDITEM(pItem['mask'], pItem['cx'], pItem['fmt'], pItem['state'], pItem['iOrder'],
                                     pItem['pszText'], pItem['cchMaxText'], pItem['lParam'], pItem['bDpiAware'],
                                     pItem['bVisible'], pItem['fWeight'])
        return <BOOL>this.lpVtbl.SetItem(this, iItem, &_item)

    # UINT GetItemCount(const IHeaderCtrl* this)
    def GetItemCount(self):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemCount(this)

    # int GetTotalWidth(const IHeaderCtrl* this, BOOL bMinWid)
    def GetTotalWidth(self, bMinWid):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTotalWidth(this, <BOOL>bMinWid)

    # BOOL IsAutoResize(const IHeaderCtrl* this)
    def IsAutoResize(self):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsAutoResize(this)

    # int GetItemWidth(const IHeaderCtrl* this, int iItem)
    def GetItemWidth(self, iItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemWidth(this, iItem)

    # BOOL DeleteItem(IHeaderCtrl* this, int iItem)
    def DeleteItem(self, iItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DeleteItem(this, iItem)

    # void DeleteAllItems(IHeaderCtrl* this)
    def DeleteAllItems(self):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.DeleteAllItems(this)

    # void SetItemSort(IHeaderCtrl* this, int iItem, UINT sortFlag)
    def SetItemSort(self, iItem, sortFlag):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemSort(this, iItem, sortFlag)

    # void SetItemVisible(IHeaderCtrl* this, int iItem, BOOL visible)
    def SetItemVisible(self, iItem, visible):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemVisible(this, iItem, <BOOL>visible)

    # BOOL IsItemVisible(const IHeaderCtrl* this, int iItem)
    def IsItemVisible(self, iItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsItemVisible(this, iItem)

    # int GetOriItemIndex(const IHeaderCtrl* this, int iOrder)
    def GetOriItemIndex(self, iOrder):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetOriItemIndex(this, iOrder)

    # void GetItemRect(const IHeaderCtrl* this, int iItem, LPRECT prc)
    def GetItemRect(self, iItem):
        cdef IHeaderCtrl* this = <IHeaderCtrl*><DWORD_PTR>self._thisptr
        cdef RECT _rc
        this.lpVtbl.GetItemRect(this, iItem, &_rc)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

cdef class SLvAdapter(SObjRef):
    def __init__(self):
        cdef ILvAdapterData* data = <ILvAdapterData*>malloc(sizeof(ILvAdapterData))
        data.adapter.lpVtbl = &vtblLvAdapter
        data.nRefs = 1
        data.obz = NULL
        data.self = <PyObject*>self
        super().__init__(<DWORD_PTR>&data.adapter)
    
    @staticmethod
    def from_ptr(ptr, owner=False):
        cdef SLvAdapter obj = SLvAdapter.__new__(SLvAdapter)
        obj._thisptr = <DWORD_PTR>ptr
        obj._owner = owner
        return obj

    def notifyChanged(self):
        cdef ILvAdapter* this = <ILvAdapter*><DWORD_PTR>self._thisptr
        LvAdapter_DataSetObserver_notifyChanged(this) 

    def notifyInvalidated(self):
        cdef ILvAdapter* this = <ILvAdapter*><DWORD_PTR>self._thisptr
        LvAdapter_DataSetObserver_notifyInvalidated(this)

    def notifyItemChanged(self, nItem):
        cdef ILvAdapter* this = <ILvAdapter*><DWORD_PTR>self._thisptr
        LvAdapter_DataSetObserver_notifyItemChanged(this, nItem)

    # int getCount(ILvAdapter* this)
    def getCount(self):
        return 0

    # void getView(ILvAdapter* this, int position, IWindow*pItem, IXmlNode*xmlTemplate)
    def getView(self, position, pItem, xmlTemplate):
        cdef ILvAdapter* this = <ILvAdapter*><DWORD_PTR>self._thisptr
        cdef IWindow* _pItem = <IWindow*><DWORD_PTR>pItem.ptr()
        if _pItem.lpVtbl.GetChildrenCount(_pItem) == 0:
            _pItem.lpVtbl.InitFromXml(_pItem, <IXmlNode*><DWORD_PTR>xmlTemplate)

    # int getItemViewType(ILvAdapter* this, int position, DWORD dwState)
    def getItemViewType(self, position, dwState):
        return 0

    # int getViewTypeCount(ILvAdapter* this)
    def getViewTypeCount(self):
        return 1

    # void __stdcall getViewDesiredSize(ILvAdapter* this, SIZE* pSize, int position, IWindow*pItem, int wid, int hei)
    def getViewDesiredSize(self, position, pItem, wid, hei):
        sz = pItem.GetDesiredSize(wid, hei)
        return {'cx': sz.cx, 'cy': sz.cy}

    # BOOL isEmpty(ILvAdapter* this)
    def isEmpty(self):
        return <BOOL>False

    # HRESULT QueryInterface(ILvAdapter* this, REFGUID id, IObjRef**ppObj)
    def QueryInterface(self, id):
        return E_NOINTERFACE

cdef class SListView(SPanel):
    cdef object _adapter
    IID = (0x107ed2ea, 0x6c95, 0x4cec, [0xa3,0x0,0x2c,0xe5,0xab,0x0a,0x7d,0xdb])
    
    # BOOL SetAdapter(IListView* this, ILvAdapter* adapter)
    def SetAdapter(self, adapter):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        if this.lpVtbl.SetAdapter(this, <ILvAdapter*><DWORD_PTR>adapter.ptr()):
            self._adapter = adapter
            return True
        return False

    # ILvAdapter* GetAdapter(IListView* this)
    def GetAdapter(self):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        return self._adapter

    # IListViewItemLocator* GetItemLocator(IListView* this)
    def GetItemLocator(self):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        cdef IListViewItemLocator* obj = this.lpVtbl.GetItemLocator(this)
        if obj != NULL:
            return SListViewItemLocator(<DWORD_PTR>obj)

    # void SetItemLocator(IListView* this, IListViewItemLocator* pItemLocator)
    def SetItemLocator(self, pItemLocator):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemLocator(this, <IListViewItemLocator*><DWORD_PTR>pItemLocator.ptr())

    # void EnsureVisible(IListView* this, int iItem)
    def EnsureVisible(self, iItem):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnsureVisible(this, iItem)

    # void SetSel(IListView* this, int iItem, BOOL bNotify)
    def SetSel(self, iItem, bNotify=False):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSel(this, iItem, <BOOL>bNotify)

    # int GetSel(IListView* this)
    def GetSel(self):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSel(this)

    # IItemPanel* HitTest(IListView* this, const POINT*pt)
    def HitTest(self, pt):
        cdef IListView* this = <IListView*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        cdef IItemPanel* obj = this.lpVtbl.HitTest(this, &_pt)
        if obj != NULL:
            return SItemPanel(<DWORD_PTR>obj)

cdef class SListViewItemLocator(SObjRef):
    # void SetAdapter(IListViewItemLocator* this, ILvAdapter* pAdapter)
    def SetAdapter(self, adapter):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAdapter(this, <ILvAdapter*><DWORD_PTR>adapter.ptr())

    # void OnDataSetChanged(IListViewItemLocator* this)
    def OnDataSetChanged(self):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnDataSetChanged(this)

    # BOOL IsFixHeight(const IListViewItemLocator* this)
    def IsFixHeight(self):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsFixHeight(this)

    # int GetItemHeight(const IListViewItemLocator* this, int iItem)
    def GetItemHeight(self, iItem):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemHeight(this, iItem)

    # void SetItemHeight(IListViewItemLocator* this, int iItem, int nHeight)
    def SetItemHeight(self, iItem, nHeight):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemHeight(this, iItem, nHeight)

    # int GetTotalHeight(IListViewItemLocator* this)
    def GetTotalHeight(self):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTotalHeight(this)

    # int Item2Position(IListViewItemLocator* this, int iItem)
    def Item2Position(self, iItem):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Item2Position(this, iItem)

    # int Position2Item(IListViewItemLocator* this, int position)
    def Position2Item(self, position):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Position2Item(this, position)

    # int GetScrollLineSize(const IListViewItemLocator* this)
    def GetScrollLineSize(self):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScrollLineSize(this)

    # int GetDividerSize(const IListViewItemLocator* this)
    def GetDividerSize(self):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDividerSize(this)

    # void SetScale(IListViewItemLocator* this, int nScale)
    def SetScale(self, nScale):
        cdef IListViewItemLocator* this = <IListViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetScale(this, nScale)

cdef class SMcAdapter(SLvAdapter):
    def __init__(self):
        cdef IMcAdapterData* data = <IMcAdapterData*>malloc(sizeof(IMcAdapterData))
        data.adapter.lpVtbl = &vtblMcAdapter
        data.nRefs = 1
        data.obz = NULL
        data.self = <PyObject*>self
        SObjRef.__init__(self, <DWORD_PTR>&data.adapter)

    @staticmethod
    def from_ptr(ptr, owner=False):
        cdef SMcAdapter obj = SMcAdapter.__new__(SMcAdapter)
        obj._thisptr = <DWORD_PTR>ptr
        obj._owner = owner
        return obj

    # void GetColumnName(IMcAdapter* this, int iCol, IStringW*pName)
    def GetColumnName(self, iCol):
        return 'col%d' % (iCol + 1)
    
    # BOOL IsColumnVisible(IMcAdapter* this, int iCol)
    def IsColumnVisible(self, iCol):
        return True
    
    # BOOL OnSort(IMcAdapter* this, int iCol, UINT*pFmts, int nCols)
    def OnSort(self, iCol, pFmts):
        return False

cdef class SMcListView(SPanel):
    cdef object _adapter
    IID = (0xa45f148c, 0xf628, 0x4df7, [0xa6,0x0e,0xb5,0x1d,0xa0,0x01,0x7b,0x00])

    # BOOL SetAdapter(IMcListView* this, IMcAdapter* adapter)
    def SetAdapter(self, adapter):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        if this.lpVtbl.SetAdapter(this, <IMcAdapter*><DWORD_PTR>adapter.ptr()):
            self._adapter = adapter
            return True
        return False

    # IMcAdapter* GetAdapter(IMcListView* this)
    def GetAdapter(self):
        return self._adapter

    # IListViewItemLocator* GetItemLocator(IMcListView* this)
    def GetItemLocator(self):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        cdef IListViewItemLocator* obj = this.lpVtbl.GetItemLocator(this)
        if obj != NULL:
            return SListViewItemLocator(<DWORD_PTR>obj)

    # void SetItemLocator(IMcListView* this, IListViewItemLocator* pItemLocator)
    def SetItemLocator(self, pItemLocator):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemLocator(this, <IListViewItemLocator*><DWORD_PTR>pItemLocator.ptr())

    # void EnsureVisible(IMcListView* this, int iItem)
    def EnsureVisible(self, iItem):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnsureVisible(this, iItem)

    # void SetSel(IMcListView* this, int iItem, BOOL bNotify)
    def SetSel(self, iItem, bNotify=False):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSel(this, iItem, <BOOL>bNotify)

    # int GetSel(IMcListView* this)
    def GetSel(self):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSel(this)

    # IItemPanel* HitTest(IMcListView* this, const POINT*pt)
    def HitTest(self, pt):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        cdef IItemPanel* obj = this.lpVtbl.HitTest(this, &_pt)
        if obj != NULL:
            return SItemPanel(<DWORD_PTR>obj)

    # IHeaderCtrl* GetIHeaderCtrl(IMcListView* this)
    def GetIHeaderCtrl(self):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        cdef IHeaderCtrl* obj = this.lpVtbl.GetIHeaderCtrl(this)
        if obj != NULL:
            return SHeaderCtrl(<DWORD_PTR>obj)

    # int InsertColumn(IMcListView* this, int nIndex, LPCTSTR pszText, int nWidth, UINT fmt, LPARAM lParam, BOOL bDpiAware, float fWeight)
    def InsertColumn(self, nIndex, pszText, nWidth, fmt, lParam, bDpiAware, fWeight):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertColumn(this, nIndex, pszText, nWidth, fmt, lParam, <BOOL>bDpiAware, fWeight)

    # void DeleteColumn(IMcListView* this, int iCol)
    def DeleteColumn(self, iCol):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        this.lpVtbl.DeleteColumn(this, iCol)

    # int GetColumnCount(IMcListView* this)
    def GetColumnCount(self):
        cdef IMcListView* this = <IMcListView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetColumnCount(this)

cdef class STreeView(SPanel):
    cdef object _adapter
    IID = (0x572ca529, 0xafff, 0x412c, [0x8a,0x51,0x20,0x14,0xa9,0x80,0x17,0x39])

    # BOOL SetAdapter(ITreeView* this, ITvAdapter* adapter)
    def SetAdapter(self, adapter):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        if this.lpVtbl.SetAdapter(this, <ITvAdapter*><DWORD_PTR>adapter.ptr()):
            self._adapter = adapter
            return True
        return False

    # ITvAdapter* GetAdapter(const ITreeView* this)
    def GetAdapter(self):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        return self._adapter

    # void SetItemLocator(ITreeView* this, ITreeViewItemLocator* pItemLocator)
    def SetItemLocator(self, pItemLocator):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemLocator(this, <ITreeViewItemLocator*><DWORD_PTR>pItemLocator.ptr())

    # ITreeViewItemLocator* GetItemLocator(const ITreeView* this)
    def GetItemLocator(self):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        cdef ITreeViewItemLocator* obj = this.lpVtbl.GetItemLocator(this)
        if obj != NULL:
            return STreeViewItemLocator(<DWORD_PTR>obj)

    # void EnsureVisible(ITreeView* this, HSTREEITEM hItem)
    def EnsureVisible(self, hItem):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnsureVisible(this, <HSTREEITEM>hItem)

    # void SetSel(ITreeView* this, HSTREEITEM hItem, BOOL bNotify)
    def SetSel(self, hItem, bNotify):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSel(this, <HSTREEITEM>hItem, <BOOL>bNotify)

    # HSTREEITEM GetSel(const ITreeView* this)
    def GetSel(self):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSel(this)

    # IItemPanel* HitTest(const ITreeView* this, const POINT*pt)
    def HitTest(self, pt):
        cdef ITreeView* this = <ITreeView*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        cdef IItemPanel* obj = this.lpVtbl.HitTest(this, &_pt)
        if obj != NULL:
            return SItemPanel(<DWORD_PTR>obj)

cdef class STreeViewItemLocator(SObjRef):
    # void SetAdapter(ITreeViewItemLocator* this, ITvAdapter* pAdapter)
    def SetAdapter(self, adapter):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAdapter(this, <ITvAdapter*><DWORD_PTR>adapter.ptr())

    # void OnBranchChanged(ITreeViewItemLocator* this, HSTREEITEM hItem)
    def OnBranchChanged(self, hItem):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnBranchChanged(this, <HSTREEITEM>hItem)

    # void OnBranchExpandedChanged(ITreeViewItemLocator* this, HSTREEITEM hItem, BOOL bExpandedOld, BOOL bExpandedNew)
    def OnBranchExpandedChanged(self, hItem, bExpandedOld, bExpandedNew):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        # this.lpVtbl.OnBranchExpandedChanged(this, <HSTREEITEM>hItem, <BOOL>bExpandedOld, <BOOL>bExpandedNew)

    # int GetTotalHeight(const ITreeViewItemLocator* this)
    def GetTotalHeight(self):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTotalHeight(this)

    # int GetTotalWidth(const ITreeViewItemLocator* this)
    def GetTotalWidth(self):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTotalWidth(this)

    # int Item2Position(const ITreeViewItemLocator* this, HSTREEITEM hItem)
    def Item2Position(self, hItem):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Item2Position(this, <HSTREEITEM>hItem)

    # HSTREEITEM Position2Item(const ITreeViewItemLocator* this, int position)
    def Position2Item(self, position):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Position2Item(this, position)

    # int GetScrollLineSize(const ITreeViewItemLocator* this)
    def GetScrollLineSize(self):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScrollLineSize(this)

    # void SetItemWidth(ITreeViewItemLocator* this, HSTREEITEM hItem, int nWidth)
    def SetItemWidth(self, hItem, nWidth):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemWidth(this, <HSTREEITEM>hItem, nWidth)

    # int GetItemWidth(const ITreeViewItemLocator* this, HSTREEITEM hItem)
    def GetItemWidth(self, hItem):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemWidth(this, <HSTREEITEM>hItem)

    # void SetItemHeight(ITreeViewItemLocator* this, HSTREEITEM hItem, int nHeight)
    def SetItemHeight(self, hItem, nHeight):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemHeight(this, <HSTREEITEM>hItem, nHeight)

    # int GetItemHeight(const ITreeViewItemLocator* this, HSTREEITEM hItem)
    def GetItemHeight(self, hItem):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemHeight(this, <HSTREEITEM>hItem)

    # int GetItemIndent(const ITreeViewItemLocator* this, HSTREEITEM hItem)
    def GetItemIndent(self, hItem):
        cdef ITreeViewItemLocator* this = <ITreeViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemIndent(this, <HSTREEITEM>hItem)

cdef class STileView(SPanel):
    cdef object _adapter
    IID = (0x5586ea88, 0x3d4b, 0x4d5f, [0x8f,0x71,0x43,0x6d,0x43,0x42,0x0d,0x00])

    # BOOL SetAdapter(ITileView* this, ILvAdapter* adapter)
    def SetAdapter(self, adapter):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        if this.lpVtbl.SetAdapter(this, <ILvAdapter*><DWORD_PTR>adapter.ptr()):
            self._adapter = adapter
            return True
        return False

    # ILvAdapter* GetAdapter(const ITileView* this)
    def GetAdapter(self):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        return self._adapter

    # void SetItemLocator(ITileView* this, ITileViewItemLocator* pItemLocator)
    def SetItemLocator(self, pItemLocator):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemLocator(this, <ITileViewItemLocator*><DWORD_PTR>pItemLocator.ptr())

    # ITileViewItemLocator* GetItemLocator(const ITileView* this)
    def GetItemLocator(self):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        cdef ITileViewItemLocator* obj = this.lpVtbl.GetItemLocator(this)
        if obj != NULL:
            return STileViewItemLocator(<DWORD_PTR>obj)

    # void EnsureVisible(ITileView* this, int iItem)
    def EnsureVisible(self, iItem):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnsureVisible(this, iItem)

    # void SetSel(ITileView* this, int iItem, BOOL bNotify)
    def SetSel(self, iItem, bNotify):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSel(this, iItem, <BOOL>bNotify)

    # int GetSel(const ITileView* this)
    def GetSel(self):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSel(this)

    # IItemPanel* HitTest(const ITileView* this, const POINT*pt)
    def HitTest(self, pt):
        cdef ITileView* this = <ITileView*><DWORD_PTR>self._thisptr
        cdef POINT _pt = POINT(pt['x'], pt['y'])
        cdef IItemPanel* obj = this.lpVtbl.HitTest(this, &_pt)
        if obj != NULL:
            return SItemPanel(<DWORD_PTR>obj)

cdef class STileViewItemLocator(SObjRef):
    # void SetAdapter(ITileViewItemLocator* this, ILvAdapter* pAdapter)
    def SetAdapter(self, adapter):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetAdapter(this, <ILvAdapter*><DWORD_PTR>adapter.ptr())

    # void OnDataSetChanged(ITileViewItemLocator* this)
    def OnDataSetChanged(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.OnDataSetChanged(this)

    # int GetItemHeight(const ITileViewItemLocator* this, int iItem)
    def GetItemHeight(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemHeight(this, iItem)

    # void SetItemHeight(ITileViewItemLocator* this, int iItem, int nHeight)
    def SetItemHeight(self, iItem, nHeight):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemHeight(this, iItem, nHeight)

    # RECT GetItemRect(ITileViewItemLocator* this, int iItem)
    def GetItemRect(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        cdef RECT _rc = this.lpVtbl.GetItemRect(this, iItem)
        return {'left': _rc.left, 'top': _rc.top, 'right': _rc.right, 'bottom': _rc.bottom}

    # void SetTileViewWidth(ITileViewItemLocator* this, int width, BOOL bDpiAware)
    def SetTileViewWidth(self, width, bDpiAware):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetTileViewWidth(this, width, <BOOL>bDpiAware)

    # void GetItemRowAndColIndex(ITileViewItemLocator* this, int iItem, int*row, int*col)
    def GetItemRowAndColIndex(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        cdef int _row, _col
        this.lpVtbl.GetItemRowAndColIndex(this, iItem, &_row, &_col)
        return {'row': _row, 'col': _col}

    # BOOL IsLastInRow(ITileViewItemLocator* this, int iItem)
    def IsLastInRow(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsLastInRow(this, iItem)

    # int GetUpItem(ITileViewItemLocator* this, int iItem)
    def GetUpItem(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetUpItem(this, iItem)

    # int GetDownItem(ITileViewItemLocator* this, int iItem)
    def GetDownItem(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDownItem(this, iItem)

    # int GetTotalHeight(ITileViewItemLocator* this)
    def GetTotalHeight(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTotalHeight(this)

    # int Item2Position(ITileViewItemLocator* this, int iItem)
    def Item2Position(self, iItem):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Item2Position(this, iItem)

    # int Position2Item(ITileViewItemLocator* this, int position)
    def Position2Item(self, position):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.Position2Item(this, position)

    # int GetScrollLineSize(const ITileViewItemLocator* this)
    def GetScrollLineSize(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetScrollLineSize(this)

    # int GetMarginSize(const ITileViewItemLocator* this)
    def GetMarginSize(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetMarginSize(this)

    # int SetScale(ITileViewItemLocator* this, int scale)
    def SetScale(self, scale):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetScale(this, scale)

    # int GetCountInRow(const ITileViewItemLocator* this)
    def GetCountInRow(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCountInRow(this)

    # int GetItemLineHeight(const ITileViewItemLocator* this)
    def GetItemLineHeight(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemLineHeight(this)

    # int GetItemWidth(const ITileViewItemLocator* this)
    def GetItemWidth(self):
        cdef ITileViewItemLocator* this = <ITileViewItemLocator*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemWidth(this)

cdef class SListBox(SPanel):
    IID =(0xb0b45363, 0x3d10, 0x4889, [0x94,0x59,0xa2,0xa8,0x4e,0x37,0x57,0x5f])

    # int GetCount(IListBox* this)
    def GetCount(self):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCount(this)

    # int GetCurSel(IListBox* this)
    def GetCurSel(self):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCurSel(this)

    # BOOL SetCurSel(IListBox* this, int nIndex, BOOL bNotifyChange)
    def SetCurSel(self, nIndex, bNotifyChange):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetCurSel(this, nIndex, <BOOL>bNotifyChange)

    # int GetTopIndex(IListBox* this)
    def GetTopIndex(self):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTopIndex(this)

    # BOOL SetTopIndex(IListBox* this, int nIndex)
    def SetTopIndex(self, nIndex):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetTopIndex(this, nIndex)

    # int GetItemHeight(IListBox* this)
    def GetItemHeight(self):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemHeight(this)

    # void SetItemHeight(IListBox* this, int nItemHeight)
    def SetItemHeight(self, nItemHeight):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetItemHeight(this, nItemHeight)

    # LPARAM GetItemData(IListBox* this, int nIndex)
    def GetItemData(self, nIndex):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemData(this, nIndex)

    # BOOL SetItemData(IListBox* this, int nIndex, LPARAM lParam)
    def SetItemData(self, nIndex, lParam):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemData(this, nIndex, lParam)

    # BOOL GetIText(IListBox* this, int nIndex, BOOL bRawText, IStringT*str)
    def GetText(self, nIndex, bRawText=False):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        strText = SOUI.SOUI_FACTORY.CreateStringW()
        this.lpVtbl.GetIText(this, nIndex, <BOOL>bRawText, <IStringT*><DWORD_PTR>strText.ptr())
        return strText.c_str()

    # void DeleteAll(IListBox* this)
    def DeleteAll(self):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        this.lpVtbl.DeleteAll(this)

    # BOOL DeleteString(IListBox* this, int nIndex)
    def DeleteString(self, nIndex):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DeleteString(this, nIndex)

    # int AddString(IListBox* this, LPCTSTR lpszItem, int nImage, LPARAM lParam)
    def AddString(self, lpszItem, nImage=-1, lParam=0):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.AddString(this, lpszItem, nImage, lParam)

    # int InsertString(IListBox* this, int nIndex, LPCTSTR lpszItem, int nImage, LPARAM lParam)
    def InsertString(self, nIndex, lpszItem, nImage, lParam):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertString(this, nIndex, lpszItem, nImage, lParam)

    # void EnsureVisible(IListBox* this, int nIndex)
    def EnsureVisible(self, nIndex):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        this.lpVtbl.EnsureVisible(this, nIndex)

    # int FindString(IListBox* this, int iFindAfter, LPCTSTR pszText)
    def FindString(self, iFindAfter, pszText):
        cdef IListBox* this = <IListBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.FindString(this, iFindAfter, pszText)

cdef class SComboBase(SCtrl):
    IID =(0x5fb30471, 0x54cb, 0x4db8, [0x91,0x60,0x31,0xb5,0x45,0xe2,0x8b,0xc5])

    # int GetCurSel(IComboBase* this)
    def GetCurSel(self):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCurSel(this)

    # int GetCount(IComboBase* this)
    def GetCount(self):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCount(this)

    # BOOL SetCurSel(IComboBase* this, int iSel)
    def SetCurSel(self, iSel):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetCurSel(this, iSel)

    # BOOL GetItemText(IComboBase* this, int iItem, BOOL bRawText, IStringT*str)
    def GetItemText(self, iItem, bRawText=False):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        strText = SOUI.SOUI_FACTORY.CreateStringW()
        this.lpVtbl.GetItemText(this, iItem, <BOOL>bRawText, <IStringT*><DWORD_PTR>strText.ptr())
        return strText.c_str()

    # int FindString(IComboBase* this, LPCTSTR pszFind, int nAfter, BOOL bPartMatch)
    def FindString(self, pszFind, nAfter, bPartMatch):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        return this.lpVtbl.FindString(this, pszFind, nAfter, <BOOL>bPartMatch)

    # void DropDown(IComboBase* this)
    def DropDown(self):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        this.lpVtbl.DropDown(this)

    # void CloseUp(IComboBase* this)
    def CloseUp(self):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        this.lpVtbl.CloseUp(this)

    # BOOL IsDropdown(IComboBase* this)
    def IsDropdown(self):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.IsDropdown(this)

    # void SetDropdown(IComboBase* this, BOOL bDropdown)
    def SetDropdown(self, bDropdown):
        cdef IComboBase* this = <IComboBase*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetDropdown(this, <BOOL>bDropdown)

cdef class SComboBox(SComboBase):
    IID =(0xe7f9c5a6, 0xea49, 0x41c8, [0x9d,0x8f,0x70,0x75,0xcb,0x96,0x74,0xea])

    # LPARAM GetItemData(IComboBox* this, UINT iItem)
    def GetItemData(self, iItem):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemData(this, iItem)

    # BOOL SetItemData(IComboBox* this, UINT iItem, LPARAM lParam)
    def SetItemData(self, iItem, lParam):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemData(this, iItem, lParam)

    # int InsertItem(IComboBox* this, int iPos, LPCTSTR pszText, int iIcon, LPARAM lParam)
    def InsertItem(self, iPos, pszText, iIcon, lParam):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertItem(this, iPos, pszText, iIcon, lParam)

    # BOOL DeleteString(IComboBox* this, int iPos)
    def DeleteString(self, iPos):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.DeleteString(this, iPos)

    # void ResetContent(IComboBox* this)
    def ResetContent(self):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        this.lpVtbl.ResetContent(this)

    # IListBox* GetIListBox(IComboBox* this)
    def GetIListBox(self):
        cdef IComboBox* this = <IComboBox*><DWORD_PTR>self._thisptr
        cdef IListBox* obj = this.lpVtbl.GetIListBox(this)
        if obj != NULL:
            return SListBox(<DWORD_PTR>obj)

cdef class SDateTimePicker(SCtrl):
    IID =(0x846f25cd, 0xe0db, 0x49b0, [0x8f,0x20,0x0b,0xd7,0x05,0x38,0xf6,0x31])

    # void SetTime(IDateTimePicker* this, WORD wYear, WORD wMonth, WORD wDay, WORD wHour, WORD wMinute, WORD wSecond)
    def SetTime(self, wYear, wMonth, wDay, wHour, wMinute, wSecond):
        cdef IDateTimePicker* this = <IDateTimePicker*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetTime(this, <WORD>wYear, <WORD>wMonth, <WORD>wDay, <WORD>wHour, <WORD>wMinute, <WORD>wSecond)

    # void GetTime(const IDateTimePicker* this, WORD* wYear, WORD* wMonth, WORD* wDay, WORD* wHour, WORD* wMinute, WORD* wSecond)
    def GetTime(self):
        cdef IDateTimePicker* this = <IDateTimePicker*><DWORD_PTR>self._thisptr
        cdef WORD _wYear, _wMonth, _wDay, _wHour, _wMinute, _wSecond
        this.lpVtbl.GetTime(this, &_wYear, &_wMonth, &_wDay, &_wHour, &_wMinute, &_wSecond)
        return {'year': _wYear, 'month': _wMonth, 'day': _wDay, 'hour': _wHour, 'minute': _wMinute, 'second': _wSecond}

    # void CloseUp(IDateTimePicker* this)
    def CloseUp(self):
        cdef IDateTimePicker* this = <IDateTimePicker*><DWORD_PTR>self._thisptr
        this.lpVtbl.CloseUp(this)

    # void DropDown(IDateTimePicker* this)
    def DropDown(self):
        cdef IDateTimePicker* this = <IDateTimePicker*><DWORD_PTR>self._thisptr
        this.lpVtbl.DropDown(this)

    # void Clear(IDateTimePicker* this)
    def Clear(self):
        cdef IDateTimePicker* this = <IDateTimePicker*><DWORD_PTR>self._thisptr
        this.lpVtbl.Clear(this)

cdef class STreeCtrl(SCtrl):
    IID =(0xa877b61c, 0x7e5e, 0x4716, [0x84,0x23,0x8d,0xc6,0x1e,0xaf,0x61,0xe9])

    # HSTREEITEM InsertItem(ITreeCtrl* this, LPCTSTR lpszItem, int nImage, int nSelectedImage, LPARAM lParam, HSTREEITEM hParent, HSTREEITEM hInsertAfter)
    def InsertItem(self, lpszItem, nImage, nSelectedImage, lParam, hParent, hInsertAfter):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertItem(this, lpszItem, nImage, nSelectedImage, lParam, <HSTREEITEM>hParent, <HSTREEITEM>hInsertAfter)

    # BOOL RemoveItem(ITreeCtrl* this, HSTREEITEM hItem)
    def RemoveItem(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveItem(this, <HSTREEITEM>hItem)

    # void RemoveAllItems(ITreeCtrl* this)
    def RemoveAllItems(self):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.RemoveAllItems(this)

    # HSTREEITEM GetRootItem(const ITreeCtrl* this)
    def GetRootItem(self):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetRootItem(this)

    # HSTREEITEM GetNextSiblingItem(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetNextSiblingItem(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetNextSiblingItem(this, <HSTREEITEM>hItem)

    # HSTREEITEM GetPrevSiblingItem(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetPrevSiblingItem(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetPrevSiblingItem(this, <HSTREEITEM>hItem)

    # HSTREEITEM GetChildItem(const ITreeCtrl* this, HSTREEITEM hItem, BOOL bFirst)
    def GetChildItem(self, hItem, bFirst):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetChildItem(this, <HSTREEITEM>hItem, <BOOL>bFirst)

    # HSTREEITEM GetParentItem(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetParentItem(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetParentItem(this, <HSTREEITEM>hItem)

    # HSTREEITEM GetSelectedItem(const ITreeCtrl* this)
    def GetSelectedItem(self):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetSelectedItem(this)

    # HSTREEITEM GetNextItem(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetNextItem(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetNextItem(this, <HSTREEITEM>hItem)

    # BOOL SelectItem(ITreeCtrl* this, HSTREEITEM hItem, BOOL bEnsureVisible)
    def SelectItem(self, hItem, bEnsureVisible):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SelectItem(this, <HSTREEITEM>hItem, <BOOL>bEnsureVisible)

    # BOOL GetItemText(const ITreeCtrl* this, HSTREEITEM hItem, IStringT* strText)
    def GetItemText(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        strText = SOUI.SOUI_FACTORY.CreateStringW()
        this.lpVtbl.GetItemText(this, <HSTREEITEM>hItem, <IStringT*><DWORD_PTR>strText.ptr())
        return strText.c_str()

    # BOOL SetItemText(ITreeCtrl* this, HSTREEITEM hItem, LPCTSTR lpszItem)
    def SetItemText(self, hItem, lpszItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemText(this, <HSTREEITEM>hItem, lpszItem)

    # BOOL GetItemImage(const ITreeCtrl* this, HSTREEITEM hItem, int*nImage, int*nSelectedImage)
    def GetItemImage(self, hItem, nImage, nSelectedImage):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        cdef int _nImage, _nSelectedImage
        if this.lpVtbl.GetItemImage(this, <HSTREEITEM>hItem, &_nImage, &_nSelectedImage):
            return {'image': _nImage, 'selected_image': _nSelectedImage}

    # BOOL SetItemImage(ITreeCtrl* this, HSTREEITEM hItem, int nImage, int nSelectedImage)
    def SetItemImage(self, hItem, nImage, nSelectedImage):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemImage(this, <HSTREEITEM>hItem, nImage, nSelectedImage)

    # LPARAM GetItemData(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetItemData(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemData(this, <HSTREEITEM>hItem)

    # BOOL SetItemData(ITreeCtrl* this, HSTREEITEM hItem, LPARAM lParam)
    def SetItemData(self, hItem, lParam):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemData(this, <HSTREEITEM>hItem, lParam)

    # BOOL ItemHasChildren(const ITreeCtrl* this, HSTREEITEM hItem)
    def ItemHasChildren(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.ItemHasChildren(this, <HSTREEITEM>hItem)

    # int GetCheckState(const ITreeCtrl* this, HSTREEITEM hItem)
    def GetCheckState(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCheckState(this, <HSTREEITEM>hItem)

    # BOOL SetCheckState(ITreeCtrl* this, HSTREEITEM hItem, BOOL bCheck)
    def SetCheckState(self, hItem, bCheck):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetCheckState(this, <HSTREEITEM>hItem, <BOOL>bCheck)

    # BOOL Expand(ITreeCtrl* this, HSTREEITEM hItem, UINT nCode)
    def Expand(self, hItem, nCode):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.Expand(this, <HSTREEITEM>hItem, nCode)

    # BOOL EnsureVisible(ITreeCtrl* this, HSTREEITEM hItem)
    def EnsureVisible(self, hItem):
        cdef ITreeCtrl* this = <ITreeCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.EnsureVisible(this, <HSTREEITEM>hItem)

cdef class SHotKeyCtrl(SCtrl):
    IID =(0xe21767ac, 0x6a40, 0x45a2, [0x9e,0x5c,0xea,0x5c,0xdf,0x51,0x6c,0x60])

    # void SetRule(IHotKeyCtrl* this, WORD wInvalidComp, WORD wModifier)
    def SetRule(self, wInvalidComp, wModifier):
        cdef IHotKeyCtrl* this = <IHotKeyCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetRule(this, <WORD>wInvalidComp, <WORD>wModifier)

    # void SetHotKey(IHotKeyCtrl* this, WORD wKey, WORD wModifiers)
    def SetHotKey(self, wKey, wModifiers):
        cdef IHotKeyCtrl* this = <IHotKeyCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetHotKey(this, <WORD>wKey, <WORD>wModifiers)

    # void GetHotKey(const IHotKeyCtrl* this, WORD* wKey, WORD* wModifers)
    def GetHotKey(self):
        cdef IHotKeyCtrl* this = <IHotKeyCtrl*><DWORD_PTR>self._thisptr
        cdef WORD _wKey, _wModifers
        this.lpVtbl.GetHotKey(this, &_wKey, &_wModifers)
        return {'key': _wKey, 'modifers': _wModifers}

cdef class SRichEdit(SCtrl):
    IID =(0x7b9c2c3e, 0x3101, 0x4cda, [0x94,0x36,0xf8,0x8d,0x99,0x93,0xba,0x5f])

    # DWORD SaveRtf(IRichEdit* this, LPCTSTR pszFileName)
    def SaveRtf(self, pszFileName):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SaveRtf(this, pszFileName)

    # DWORD LoadRtf(IRichEdit* this, LPCTSTR pszFileName)
    def LoadRtf(self, pszFileName):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.LoadRtf(this, pszFileName)

    # void SetSel(IRichEdit* this, long nStartChar, long nEndChar, BOOL bNoScroll)
    def SetSel(self, nStartChar, nEndChar, bNoScroll):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetSel(this, nStartChar, nEndChar, <BOOL>bNoScroll)

    # void ReplaceSel(IRichEdit* this, LPCTSTR pszText, BOOL bCanUndo)
    def ReplaceSel(self, pszText, bCanUndo):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.ReplaceSel(this, pszText, <BOOL>bCanUndo)

    # BOOL GetWordWrap(const IRichEdit* this)
    def GetWordWrap(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetWordWrap(this)

    # void SetWordWrap(IRichEdit* this, BOOL fWordWrap)
    def SetWordWrap(self, fWordWrap):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetWordWrap(this, <BOOL>fWordWrap)

    # BOOL GetReadOnly(const IRichEdit* this)
    def GetReadOnly(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetReadOnly(this)

    # BOOL SetReadOnly(IRichEdit* this, BOOL bReadOnly)
    def SetReadOnly(self, bReadOnly):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetReadOnly(this, <BOOL>bReadOnly)

    # LONG GetLimitText(const IRichEdit* this)
    def GetLimitText(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetLimitText(this)

    # BOOL SetLimitText(IRichEdit* this, int nLength)
    def SetLimitText(self, nLength):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetLimitText(this, nLength)

    # WORD GetDefaultAlign(const IRichEdit* this)
    def GetDefaultAlign(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDefaultAlign(this)

    # void SetDefaultAlign(IRichEdit* this, WORD wNewAlign)
    def SetDefaultAlign(self, wNewAlign):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetDefaultAlign(this, <WORD>wNewAlign)

    # BOOL GetRichTextFlag(const IRichEdit* this)
    def GetRichTextFlag(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.GetRichTextFlag(this)

    # void SetRichTextFlag(IRichEdit* this, BOOL fRich)
    def SetRichTextFlag(self, fRich):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetRichTextFlag(this, <BOOL>fRich)

    # LONG GetDefaultLeftIndent(const IRichEdit* this)
    def GetDefaultLeftIndent(self):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetDefaultLeftIndent(this)

    # void SetDefaultLeftIndent(IRichEdit* this, LONG lNewIndent)
    def SetDefaultLeftIndent(self, lNewIndent):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetDefaultLeftIndent(this, <LONG>lNewIndent)

    # BOOL SetSaveSelection(IRichEdit* this, BOOL fSaveSelection)
    def SetSaveSelection(self, fSaveSelection):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetSaveSelection(this, <BOOL>fSaveSelection)

    # COLORREF SetDefaultTextColor(IRichEdit* this, COLORREF cr)
    def SetDefaultTextColor(self, cr):
        cdef IRichEdit* this = <IRichEdit*><DWORD_PTR>self._thisptr
        return this.lpVtbl.SetDefaultTextColor(this, <COLORREF>cr)

cdef class STabPage(SCtrl):
    IID =(0xa32ed365, 0xe6b8, 0x4ada, [0xbe, 0x49, 0xbc, 0xf1, 0x27, 0xf9, 0x44, 0x27])

    # LPCTSTR GetTitle(const ITabPage* this)
    def GetTitle(self):
        cdef ITabPage* this = <ITabPage*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetTitle(this)

    # void SetTitle(ITabPage* this, LPCTSTR lpszTitle)
    def SetTitle(self, lpszTitle):
        cdef ITabPage* this = <ITabPage*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetTitle(this, lpszTitle)

    # int GetIconIndex(const ITabPage* this)
    def GetIconIndex(self):
        cdef ITabPage* this = <ITabPage*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetIconIndex(this)

    # void SetIconIndex(ITabPage* this, int iIcon)
    def SetIconIndex(self, iIcon):
        cdef ITabPage* this = <ITabPage*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetIconIndex(this, iIcon)

cdef class STabCtrl(SCtrl):
    IID =(0x17714866, 0x88b9, 0x480b, [0x83, 0xd1, 0xf0, 0x44, 0x48, 0x6d, 0x78, 0xd1])
    
    # int GetCurSel(ITabCtrl* this)
    def GetCurSel(self):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetCurSel(this)

    # BOOL SetCurSel(ITabCtrl* this, int nIndex)
    def SetCurSel(self, nIndex):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetCurSel(this, nIndex)

    # BOOL SetItemTitle(ITabCtrl* this, int nIndex, LPCTSTR lpszTitle)
    def SetItemTitle(self, nIndex, lpszTitle):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.SetItemTitle(this, nIndex, lpszTitle)

    # int InsertItem(ITabCtrl* this, LPCWSTR lpContent, int iInsert)
    def InsertItem(self, lpContent, iInsert):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.InsertItem(this, lpContent, iInsert)

    # int GetItemCount(ITabCtrl* this)
    def GetItemCount(self):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetItemCount(this)

    # ITabPage* GetPage(ITabCtrl* this, int nIndex)
    def GetPage(self, nIndex):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        cdef ITabPage* obj = this.lpVtbl.GetPage(this, nIndex)
        if obj != NULL:
            return STabPage(<DWORD_PTR>obj)

    # BOOL RemoveItem(ITabCtrl* this, int nIndex, int iSelPage)
    def RemoveItem(self, nIndex, iSelPage=False):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return <BOOL>this.lpVtbl.RemoveItem(this, nIndex, iSelPage)

    # void RemoveAllItems(ITabCtrl* this)
    def RemoveAllItems(self):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.RemoveAllItems(this)

    # int GetPageIndex(ITabCtrl* this, LPCTSTR pszName, BOOL bTitle)
    def GetPageIndex(self, pszName, bTitle=True):
        cdef ITabCtrl* this = <ITabCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetPageIndex(this, pszName, <BOOL>bTitle)

cdef class SSpinButtonCtrl(SCtrl):
    IID =(0x7f8df81c, 0x6c6e, 0x4572,[ 0xbd, 0xe6, 0x7, 0x57, 0xa4, 0xd0, 0x7c, 0x5f])

    # void SetValue(ISpinButtonCtrl* this, int nValue)
    def SetValue(self, nValue):
        cdef ISpinButtonCtrl* this = <ISpinButtonCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetValue(this, nValue)

    # void SetRange(ISpinButtonCtrl* this, int nMin, int nMax)
    def SetRange(self, nMin, nMax):
        cdef ISpinButtonCtrl* this = <ISpinButtonCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetRange(this, nMin, nMax)

    # void SetStep(ISpinButtonCtrl* this, UINT nStep)
    def SetStep(self, nStep):
        cdef ISpinButtonCtrl* this = <ISpinButtonCtrl*><DWORD_PTR>self._thisptr
        this.lpVtbl.SetStep(this, nStep)

    # int GetValue(const ISpinButtonCtrl* this)
    def GetValue(self):
        cdef ISpinButtonCtrl* this = <ISpinButtonCtrl*><DWORD_PTR>self._thisptr
        return this.lpVtbl.GetValue(this)

    # IWindow* GetIBuddy(const ISpinButtonCtrl* this)
    def GetBuddy(self):
        cdef ISpinButtonCtrl* this = <ISpinButtonCtrl*><DWORD_PTR>self._thisptr
        cdef IWindow* obj = this.lpVtbl.GetIBuddy(this)
        if obj != NULL:
            return SWindow(<DWORD_PTR>obj)
